I have one table called Equipment and a second table called Reserve. The relationship between
the two tables is TicketNo. Here is my query:
SELECT DISTINCT [Reserve].[TicketNo], [Equipment].[TicketNo], [Reserve].[Date1], [Reserve].[Date2] FROM Equipment LEFT JOIN Reserve ON [Equipment].[TicketNo]=[Reserve].[TicketNo];
In the Reserve table I have three records:
TicketNo Date1 Date2
12345 27/05/05 27/05/05
22222 23/05/02 23/05/05
12345 30/05/05 31/05/05
As you can see, ticket 12345 displays twice.
Is there a way to modify my query to group by ticket number with the most recent date:
TicketNo Date1 Date2
12345 27/05/05 27/05/05
22222 23/05/02 23/05/05
the two tables is TicketNo. Here is my query:
SELECT DISTINCT [Reserve].[TicketNo], [Equipment].[TicketNo], [Reserve].[Date1], [Reserve].[Date2] FROM Equipment LEFT JOIN Reserve ON [Equipment].[TicketNo]=[Reserve].[TicketNo];
In the Reserve table I have three records:
TicketNo Date1 Date2
12345 27/05/05 27/05/05
22222 23/05/02 23/05/05
12345 30/05/05 31/05/05
As you can see, ticket 12345 displays twice.
Is there a way to modify my query to group by ticket number with the most recent date:
TicketNo Date1 Date2
12345 27/05/05 27/05/05
22222 23/05/02 23/05/05