MySQL Forums
Forum List  »  Newbie

which kind of join?
Posted by: lorenzo lucioni
Date: June 11, 2014 02:33AM

Hi, I have these two tables:

TABLE A
-------
ID NAME
1 abc
2 def
3 ghi

TABLE B
-------
ID ID_TABLE_A VALUE
1 1 aaaa
2 1 bbbb
3 2 cccc

I would select all rows from TABLE A that aren't referenced from TABLE B with a VALUE='aaaa'.
I mean: I'm especting the following query result:

RESULT (column from TABLE A only)
------
ID NAME
2 def
3 ghi

- row with ID=1 does not show because it is referenced by TABLE B with VALUE='aaaa'
- row with ID=2 shows because it is NOT referenced by TABLE B with VALUE='aaaa'
- row with ID=3 shows because it is NOT referenced by TABLE B in no way

(please does not suggest different tables structure: these two tables are just to represent my trouble about joins)

thank you,
lorenzo

Options: ReplyQuote


Subject
Written By
Posted
which kind of join?
June 11, 2014 02:33AM
June 11, 2014 10:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.