I'm pretty new to SQL but hit a wall last night when I was experimenting on my website. I've been trying to figure it out now for hours with no luck, so here's my first post on Stack Overflow!
My issue is that I'm trying to sort a table of results, however what I need to sort by is from a different query from the main data. So I have a table of data that outputs fine, but I can't use ORDER BY to the field I want because it comes from a different query.
I have two tables:
character_
quest_globals
Data I need from the two tables:
character_.id
character_.name
character_.class
character_.level
quest_globals.charid (Same value as character_.id)
quest_globals.name
quest_globals.value
Ordered by: quest_globals.value
I would like to join these two tables so I can order the results how I like. Do I need to use UNION or JOIN for this?
character_
and quest_globals
have a common field as character_.id
is the same as quest_globals.charid
so I'm guessing I use this to join?