I have the following SQL view:
CREATE VIEW [dbo].[VW_ScanData]
AS
SELECT
top 10 ID,
Chip_ID,
[IPAddress] As FilterKey,
[DateTime]
FROM
TBL_ScanData WITH(NOLOCK)
ORDER BY ID DESC
GO
The idea is that this returns the 10 most recent entries. I have been told to to use a filterkey to check recent entries per IP Address.
The problem is that as it stands above, it will return the top 10 entries and remove all the ones that dont match the filter key which means in some cases it will not return anything.
I want it to return the 10 most recent entries of the given IP Address (Filter key).
I have tried removing 'top 10', but it will then not accept the order by clause, meaning it will not necessarily give the most recent entries.
As said, I need to use a filter key to comply with the rest of the framework of the project