Hi everyone, I have a database (not designed by me) in sql server, I am
having trouble ordering it correctly, and I would appreciate any help.
Here is my structure, it's sort of hierarchical:
TABLE_A
ID_COL
SUB_ID_COL
TABLE_B
ID_COL'
NAME
This could be thought of as an employee and supervisor structure. We
have employees (TABLE_B) and their relationship (TABLE_A).
I know I need to use a group and oder by, but I am drawing blanks
today. I need the result to be (if using the employee example):
Bob
-Ryan
-Sue
Mark
Nick
-George
-Paul
--Ringo
--Star
Here is my half-hearted stab at it:
SELECT *
FROM TABLE_A A
INNER JOIN TABLE_B B
GROUP BY A.SUB_ID_COL
ORDER BY NAME;
Thank you very much for any help you can offer.
Have a great night!
Ryan