Hi Experts,
I have the below data set for sales order and sequence in a table. This table is at vendor location and I access the data via dblink. I can only select these two columns. Now i need to select in such a way that i select distinct so numbers but it should be in the sorted as per below table ,i.e. 7037561280,7037567671,7037633589,7037630443,7037627397,7037601762 ....7037619156. If i do a select distinct or group by so number , i get distinct values but they are not in the same order as below . I tried using RANK and DENSE_RANK function as below to check if i can use these to get the desired output. But it does not work because when i do a partition by so-number , the rank again begins with 1.
Hence can you help me/guide me to get the sorted so_number from below data set. I used below script
SELECT so_number
,seq_no,
DENSE_RANK() OVER (PARTITION BY so_number ORDER BY seq_no) AS myrank
FROM
xx_om_sellout_data
order by seq_no
so_number | seq_no |
---|
7037561280 | 2 |
7037561280 | 3 |
7037567671 | 4 |
7037567671 | 5 |
7037567671 | 6 |
7037567671 | 7 |
7037633589 | 8 |
7037633589 | 9 |
7037630443 | 10 |
7037630443 | 11 |
7037627397 | 12 |
7037627397 | 13 |
7037601762 | 14 |
7037601762 | 15 |
7037596364 | 16 |
7037596364 | 17 |
7037619156 | 18 |
7037619156 | 19 |
Regards,