I am new to SQL database queries and am looking for help on how to execute this one.
I think I need to use a subquery, not really sure, so I will try to break it down in steps. What I would like to do (in one query) is…
Step 1: return all the rows in the table where ERROR_CODE=3
Step 2: take all the SERIAL_NUMBERs from Step 1 and query the table again for all rows containing those SERIAL_NUMBERs
Step 3: group the results of Step 2 by SERIAL_NUMBER
Step 4: order the rows within those groups by TIME_STAMP in descending order
Step 5: order those groups by the maximum TIME_STAMP value in each group in descending order
Thanks in advance,