I have two tables, users and messages.
users has the fields userId(int) and username(string) and
messages has the fields userId(int) and message.
I have the username, and want to grab all messages related to that username’s userId.
Would the join function work in this case (and if so, how?), or would I have to make two separate queries?
Use an
INNER JOINto reference theusertable from themessagestable (matching [referencing] them both by theuserIdcolumn)And an example of the query can be found here: http://www.sqlfiddle.com/#!8/bc3ce/3/0