I have a table(order_t) that contains CustomerIDs and SalespersonIDs and I want to display SalespersonIDs with all the CustomerIDs associated with them.
I tried using SELECT DISTINCT
SELECT DISTINCT salespersonid, customerid
FROM order_t;
But that will repeat salespersonids.
Here is a table sample
salespersonid customerid
--------------- ---------------
15 1
15 2
15 3
16 4
16 5
17 6
And I want to get this dataset as the result
salespersonid customerid
--------------- ---------------
15 1
2
3
16 4
5
17 6
18 4
5
9
This worked perfectly
BREAK ON sid
SELECT DISTINCT salespersonid sid, customerid cid
FROM ORDER_T
ORDER BY salespersonid;