Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone.
I need to make one Left join in my database, but On Table1 And part of Table2.
In my Table2 i have One field for Language like this :

Table1(id,a,b,c,...)
Table2(id,s,z,x,Lang,...)

SQL
Select TUP.*,TUPI.Body,TUPI.Descriptions,TUPI.Keywords,TUPI.Name AS N'LangName',TUPI.SmallDesc From  [dbo].[TUniqueProduct]  TUP
Left Join TUniqueProductItems TUPI
On TUP.ProductID = TUPI.ProductPID
where [ProductGuID] = @ProductGuID AND [CurrentCount] > 0 AND TUP.ShopID = @ShopID And Lang = @Lang


But i need if there was not any items in Table2 where Lang = @Lang On Table1.ID = Table2.ID , however i can see fields of Table1.

Any suggestion?
Thanks in advance.
Posted

1 solution

Just a minor change.
SQL
And (Lang = @Lang or Lang is null)
 
Share this answer
 
Comments
Sander Rossel 13-Nov-11 6:06am    
My 5. I always forget that part. I had a query once which I know was right, but didn't work. Took me a day to figure out I was missing exactly that :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900