Hello
Can anybody help
I am using SQL 2000 and attempting to run a query which drags info from 3 tables:
Basically some products have data held which is different from north to south and I want to find these to correct them
When I run this as a straight forward select from product_duplications (i.e. no joins) it selects 661 items
If I join just nprice it returns 665
If I then add sprice it returns 675
If I then add product it returns 890
If I change the statment to have a where at the bottom
i.e.
It returns 827 rows
All I want is for it to show 661 rows along with the additional data from the other tables alongside (i.e. the 661 rows with additional columns)
Suspect it is something to do with my join policy but not sure what the problem is
Can anybody help please
Thanks
Damian.
Can anybody help
I am using SQL 2000 and attempting to run a query which drags info from 3 tables:
Code:
select pr.productdesc, pd.*, np.pricesuom as 'NORTHPCSUOM', sp.pricesuom as 'SOUTHPCSUOM' from product_duplications pd
left outer join product pr on pd.productid = pr.productid
left outer join nprice np on dbo.CreatePriceId(pd.productid) = np.priceid
left outer join sprice sp on dbo.CreatePriceId(pd.productid) = sp.priceid
Basically some products have data held which is different from north to south and I want to find these to correct them
When I run this as a straight forward select from product_duplications (i.e. no joins) it selects 661 items
If I join just nprice it returns 665
If I then add sprice it returns 675
If I then add product it returns 890
If I change the statment to have a where at the bottom
i.e.
Code:
where dbo.CreatePriceId(pd.productid) = np.priceid
and dbo.CreatePriceId(pd.productid) = sp.priceid
and pd.productid = pr.productid
It returns 827 rows
All I want is for it to show 661 rows along with the additional data from the other tables alongside (i.e. the 661 rows with additional columns)
Suspect it is something to do with my join policy but not sure what the problem is
Can anybody help please
Thanks
Damian.