I am trying to sort this data using SQL Query
- Sort the data using start_date descending first - this is to keep latest transactions first.
- Sort the data based on COL_A, COL_B, COL_C such that COL_A, COL_B and COL_C data are grouped consecutively for any given set of records.
I tried using ROW_NUMBER and DENSE_RANK functions - but unable to derive. Could any one please help me on this?
Table data:
| COL_A | COL_B | COL_C | TASK | START_DATE | STATUS | 
|---|---|---|---|---|---|
| REFERENCE | GOLD | ETL | Upload | 2022-08-04 16:40:17.000 | Completed | 
| REFERENCE | GOLD | ETL | Translate | 2022-08-04 16:36:33.000 | Completed | 
| REFERENCE | GOLD | ETL | Extract | 2022-08-04 16:21:41.000 | Completed | 
| Hive | BRONZE | WORKFLOW | Translate | 2022-08-04 12:30:25.000 | Failed | 
| Hive | DM | ETL | Extract | 2022-08-04 12:23:55.000 | Completed | 
| Hive | BRONZE | WORKFLOW | Extract | 2022-08-04 12:15:44.000 | Completed | 
| Standalone | CONS | ETL | Extract | 2022-08-04 07:17:31.000 | Failed | 
| Moving Window | AGG | ETL | Upload | 2022-08-03 15:08:48.000 | Completed | 
| Moving Window | AGG | ETL | Translate | 2022-08-03 15:05:41.000 | Completed | 
| Moving Window | AGG | ETL | Extract | 2022-08-03 14:53:50.000 | Completed | 
| Moving Window | ANLT | ETL | Upload | 2022-08-03 14:31:17.000 | Completed | 
| Moving Window | ANLT | ETL | Translate | 2022-08-03 14:26:17.000 | Completed | 
| Moving Window | ANLT | ETL | Extract | 2022-08-03 14:17:50.000 | Completed | 
| Hive | BRONZE | BILL | Translate | 2022-08-03 13:46:19.000 | Completed | 
| Standalone | CONS | ETL | Extract | 2022-08-03 13:34:09.000 | Failed | 
Expected Output:
| COL_A | COL_B | COL_C | TASK | START_DATE | STATUS | 
|---|---|---|---|---|---|
| REFERENCE | GOLD | ETL | Upload | 2022-08-04 16:40:17.000 | Completed | 
| REFERENCE | GOLD | ETL | Translate | 2022-08-04 16:36:33.000 | Completed | 
| REFERENCE | GOLD | ETL | Extract | 2022-08-04 16:21:41.000 | Completed | 
| Hive | BRONZE | WORKFLOW | Translate | 2022-08-04 12:30:25.000 | Failed | 
| Hive | BRONZE | WORKFLOW | Extract | 2022-08-04 12:15:44.000 | Completed | 
| Hive | DM | ETL | Extract | 2022-08-04 12:23:55.000 | Completed | 
| Standalone | CONS | ETL | Extract | 2022-08-04 07:17:31.000 | Failed | 
| Moving Window | AGG | ETL | Upload | 2022-08-03 15:08:48.000 | Completed | 
| Moving Window | AGG | ETL | Translate | 2022-08-03 15:05:41.000 | Completed | 
| Moving Window | AGG | ETL | Extract | 2022-08-03 14:53:50.000 | Completed | 
| Moving Window | ANLT | ETL | Upload | 2022-08-03 14:31:17.000 | Completed | 
| Moving Window | ANLT | ETL | Translate | 2022-08-03 14:26:17.000 | Completed | 
| Moving Window | ANLT | ETL | Extract | 2022-08-03 14:17:50.000 | Completed | 
| Hive | BRONZE | BILL | Translate | 2022-08-03 13:46:19.000 | Completed | 
| Standalone | CONS | ETL | Extract | 2022-08-03 13:34:09.000 | Failed | 
 
     
     
    