basically i want to query a table, get the userId from that table, then for each userId i want to query another table to get that users username. once i have all the usernames for each of the userIds i want to sort the results by userName. how would i do this?
i want to get all the userIds from this table where the groupId = 3
TABLE NAME: GROUPMAP:
userId | groupId
1 | 2
2 | 3
3 | 3
4 | 3
then i will need to get the username for each userId from the a different table, the Users table.
TABLE NAME: USERS:
userId | username
1 | zulu
2 | charlie
3 | bravo
4 | alpha
once i get all the usernames for each of the userIds, i want to order the usernames alphabetically then display the usernames in alphabetical order.
so my end result would look like this
userid:4 username:alpha
userid:3 username:bravo
userid:2 username:charlie
i know what i want to do but dont know how. can anyone please help?