Selecting values from one table only if a column does not match the values in the column of another table in MYSQL -
i'm using query:
select u.name, u.lastname, u.username users u, inmeeting i.memo='7' , i.user = u.keyid
to user info if keyid user in table inmeeting (which means user present) id of particular meeting (this why i.memo = 7).
now want write query gets me user info of other people not in meeting. wrote so:
select u.name, u.lastname, u.username users u, inmeeting i.memo='7' , i.user <> u.keyid
however query gets me every user twice!! don't understand i'm doing wrong or how right (well, supposed lastly 1 can done subquery, hoping little bit more elegant). ideas?
you seek with
select u.name, u.lastname, u.username users u u.keyid not in (select i.user inmeeting i.memo='7')
mysql
No comments:
Post a Comment