table structure:
id numeric - PK
EmplID - nvarcar
plate - nvarchar
date - timestamp
Rows are only ever inserted, never modified or deleted. This is basicallly a lookup table. I want to fine what plates belong to certian emplids and what emplids belong to plates. When an association is broken, emplid is set to null.
I need a query that will tell me what plates an emplid owns currently. Seems easy. Ex:
emplid plate
123 qrs
123 abc
456 def
null abc
123 xyz
the query i need would return qrs and xyz but NOT abc because an entry exists with a null with a later timestamp. Instead of null it could be anything else too (if it was 456 instead of null, the query shouldnt return it)
kind of a longconfusing situation, but it seems like something so easy - either my brain isnt working or I just cant figure this one out. Let me know if i havent been clear enough, thanks.
id numeric - PK
EmplID - nvarcar
plate - nvarchar
date - timestamp
Rows are only ever inserted, never modified or deleted. This is basicallly a lookup table. I want to fine what plates belong to certian emplids and what emplids belong to plates. When an association is broken, emplid is set to null.
I need a query that will tell me what plates an emplid owns currently. Seems easy. Ex:
emplid plate
123 qrs
123 abc
456 def
null abc
123 xyz
the query i need would return qrs and xyz but NOT abc because an entry exists with a null with a later timestamp. Instead of null it could be anything else too (if it was 456 instead of null, the query shouldnt return it)
kind of a longconfusing situation, but it seems like something so easy - either my brain isnt working or I just cant figure this one out. Let me know if i havent been clear enough, thanks.