Basti86 Posted June 19, 2008 Share Posted June 19, 2008 Good day, I am expiriencing a small problem with a mySQL statement. The problem is nothing new because I think it is about the missing FULL OUTER JOIN issue. I have read many workarounds but for some reason they just dont seem to work. I have a novice level knowhow of SQL but am eager to solve this problem( with your help ;> ). I have two tables. table A | id | structID | some more colums.. ----------------------------------- | 1 | 1 | | 1 | 2 | | 2 | 2 | table B | structID | name | other colums ----------------------------------- | 1 | AB | | 2 | BC | What I need to do is perform a SELECT on both tables and the result should be something like this: WHERE id = 2 |structID | id | name ---------------------------------- | 1 | null | AB | 2 | 2 | BC To keep it simple: I need a list of all structIDs and if they occured in the ID I sepcified. I tried it with an INNER LEFT JOIN but never received a NULL in any result.. Am I way off track, do I need to reorganize these tables or how can I accomplish what I want to do? -Greetings... Quote Link to comment Share on other sites More sharing options...
Basti86 Posted June 19, 2008 Author Share Posted June 19, 2008 Arr, where is the edit button? My SQLStatement til now: SELECT * FROM tableB LEFT JOIN tableA ON tableB.structID = tableA.structID UNION ALL SELECT * FROM tableB RIGHT JOIN tableA ON tableB.structID = tableA.structID WHERE tableA.id IS NULL Quote Link to comment Share on other sites More sharing options...
fenway Posted June 19, 2008 Share Posted June 19, 2008 Your sample output is confusing... i see matching records for everything. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.