0

I would like only select message and username from the mysql JOIN result. how do I do that? Appreciated.

Inner join

table structure

4
  • add specific columns rather * ,you can get desired output Commented Oct 31, 2015 at 6:35
  • I tried, select messages.message users.username from messages LEFT OUTER JOIN users ON messages.user_id = users.id; and it returned an error. guess becuase I put users.username when I do FROM only from messages? I could not putw both messages users after FROM. suggestion? Commented Oct 31, 2015 at 6:47
  • post your table structure of users and messages Commented Oct 31, 2015 at 6:48
  • @utility, just updated. thanks. Commented Oct 31, 2015 at 6:51

1 Answer 1

1

Inner Join can give you the desired output :

SELECT        messages.message, users.username
FROM            messages INNER JOIN
                         users ON messages.user_id = users.id
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.