Hi guys,
I'm having a real problem working this out.
I have 3 tables:
users:
userID userName
1 John
2 Jack
3 Amy
4 Paul
JoinTable:
joinID userID tagID
1 1 1
2 1 3
3 2 5
4 3 1
5 4 1
6 4 4
tagTable:
tagID tagText
1 Happy
2 Sad
3 Angry
4 Bored
5 Confused
I would really like to access the data in 3 ways...
1. I would like to output all the people in the "users" table, and show their relevant tags, even if they have none:
Example:
user: John
Tags: Happy,Angry,Confused
user: Paul
Tags: Happy,Bored
user: Paul
Tags: Happy,Bored
user: Jack
Tags: none
2. I would like to be able to search based on a username. Example:
IF username = "John" then show...
user: John
Tags: Happy,Angry,Confused
3. And finally, i would like to be able to do a "like" search on the tags themselves, to get the users...
IF tagText LIKE "%hap%" then show...
user: John
Tags: Happy,Angry,Confused
user: Paul
Tags: Happy,Bored
user: Amy
Tags: Happy
Does anyone think they could help please? I just cannot understand the left/right/inner joins and im just usless when it comes to sql 😕 🙁
Thanks for any help!
Regards.