
December 10th, 2012, 06:53 PM
|
|
Contributing User
|
|
Join Date: Aug 2006
Posts: 82
  
Time spent in forums: 2 Days 3 h 1 m 33 sec
Reputation Power: 9
|
|
|
Join 2 Select From 2 Tables
I wanted to join 2 select stmt from 2 tables.
TABLE A (3 rows)
ID | NAME
111 | AAA
111 | BBB
111 | CCC
222 | III
222 | JJJ
333 | KKK
TABLE B (4 rows)
ID | LAST
111 | EEE
111 | FFF
111 | GGG
111 | HHH
222 | PPP
222 | QQQ
222 | TTT
333 | VVV
333 | UUU
I wanted to have a result like this:
RESULT:
ID | NAME | LAST
111 AAA EEE
111 BBB FFF
111 CCC GGG
111 NULL* HHH
I tried the following query but got duplicate results.
select A.name, B.last from A, B where a.id = 111 and b.id = 111
Any ideas how to get the sample result above w/o duplicates?
Thanks,
Last edited by dikoB : December 11th, 2012 at 01:51 PM.
|