Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Join problem...should work

Author  Topic 

nic.lk
Starting Member

1 Post

Posted - 2008-07-16 : 12:39:18
I have two tables, one is a minimal details, the other is a full details. I'm trying to join the two based on a parameter I'll be passing in later. It SHOULD return 5 rows, but instead its multiplying the entire full details table by 5, and giving me roughly 500,000 rows.

Here is my query (i is the min details, d is the full). Actually I'm not doing a join as of now, just trying to get this to work, I'll convert it later....


Code:
select i.parcel_id,i.building_number,d.parcel_id from site_info i,site_desc d where i.building_number in
(select building_number from site_desc where building_number='523b')

___________
[url=http://www.insurancebyjohn.com]california renters insurance[/url] [url=http://www.taylors-coaches.co.uk]Coach Hire London[/url]

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-16 : 15:05:21
[code]select i.parcel_id,
i.building_number,
d.parcel_id
from site_info AS i
INNER JOIN site_desc AS d ON d.building_number = i.building_number
WHERE d.building_number = '523b'[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -