Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select rows from 2 or more tables where a record may not exist in tabl

Status
Not open for further replies.

mckenneyj

MIS
Jun 1, 2002
96
All match records are in table 1
Table 2 houses a subset of table 1

Table 1 has 2000 rows
Table 2 has 5000 rows
select x,y,z from table 1 where id = 'x' yeilds 1000 rows
select x,a,b,c from table 2 where id = 'x' yeilds 500 rows

This is because table only holds a subset of the data where the matching 'x' may or may not exist

My query needs to show all 1000 rows from table 1 and the colums from table 2 where a record does exist

x y z a b c
1 12 13 14 15 16
2 22 23
3 33 34 35 36 37
4 44 45
5 55 56 57 58 59

Thanks,
John McKenney
Work Hard... Play Harder
 
I see this:
My query needs to show all 1000 rows from table 1 and the colums from table 2 where a record does exist

And this:
[/quote]
Table 2 houses a subset of table 1
[/quote]

So wouldn't you just show the 1000 rows from table 1 as any row from table 2 would already be in table 1???





[monkey][snake] <.
 
The colums in table 2 hold different data

Thanks,
John McKenney
Work Hard... Play Harder
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top