I wrote a query to bring back all support tickets, but the rows for RequestID are repeating, I'd like to get the max from the created date column.
Example of the repeating RequestID:
Query being used:
select *
from [CMSystemScripts].[dbo].[CMS_CMS_and_MandR_Ticketing] Tick
inner join [dbo].[CMS_CMS_and_MandR_Ticketing_Analysis] analysis on tick.requestid = analysis.RequestID
order by 1
I thought that maybe putting MAX(*) would return the max for all columns, but I get an error
Msg 102, Level 15, State 1, Line 30
Incorrect syntax near '*'
Do I have to list the columns in the select to get the max or is there another way to accomplish this?
I am expecting to see one record for each RequestID which contains the max date on the created date column.
Any assistance would be greatly appreciated.
Thank you!
You could use the "order by" and "group by" operators to define the ordering and grouping of lines: you could follow an example like this: