SQL join tables with condition
So I would like to join 2 tables with 1 where condition:
Here is what I've tried so far:
SELECT * FROM (`ci_usertags`) JOIN `ci_tags` ON `ci_usertags`.`utag_tid`
WHERE `utag_uid` = 1
My tables look like this:
ci_usertags - utag_id, utag_uid, utag_tid
ci_tags = tag_id, tag_name
I want to select all tags for user with ID 1 and get the tag name. With
this SQL I am getting duplicite result and even the tags which are not for
the user with ID 1
No comments:
Post a Comment