In MS SQL Server 2000, I have a database with multiple tables, including a table 'Event_Times' with columns Event_ID & Event_Date_Time. There can be many Event_Date_Time entries for each Event_ID, tracking the times when a particular event occurred and reoccurred.
The 'Event_ID' column is a key that's used in other tables.
I want to find the Event_ID of records where the LAST (most recent) Event_Date_Time is more than 30 days ago, and then I wish to use that Event_ID as part of a larger query. It seems that I could get what I want by using the ORDER BY clause, but that's permitted in subqueries and similar structures only if a TOP clause is also part of the Select, and that restriction seems to negate its usefulness in my application. I'm stuck. Please help.
The 'Event_ID' column is a key that's used in other tables.
I want to find the Event_ID of records where the LAST (most recent) Event_Date_Time is more than 30 days ago, and then I wish to use that Event_ID as part of a larger query. It seems that I could get what I want by using the ORDER BY clause, but that's permitted in subqueries and similar structures only if a TOP clause is also part of the Select, and that restriction seems to negate its usefulness in my application. I'm stuck. Please help.