Could you write an SQL query that has a table A and table B where table A has an ID and table B refers to table A's ID as A_ID and get all the rows that are in table A and the rows that match in table B (even if there is no match in table B)?
Asked
Active
Viewed 150 times
1
Mureinik
- 297,002
- 52
- 306
- 350
Parvinder Singh
- 43
- 6
-
possible duplicate of [What's the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN?](http://stackoverflow.com/questions/5706437/whats-the-difference-between-inner-join-left-join-right-join-and-full-join) – FuzzyTree Apr 23 '15 at 15:35
1 Answers
1
This can easily be done with a left join:
SELECT a.id, b.a_id
FROM a
LEFT JOIN b ON a.id = b.a_id
Mureinik
- 297,002
- 52
- 306
- 350
-
Thanks Mureinik I realy appreciate your instant response once again Thanks...... :) – Parvinder Singh Apr 23 '15 at 15:32