Hi there, I have 2 tables with foreign key relationship. I am trying to get all the orders for all the customers.In case customer does not have any order it should still be giving result with Null in order field. I am using Left Outer Join but i am not getting result for the customers who dont have any orders. Any clue? Thanks!
Hi Danny, Please send me in a basic overview of the table structure so that I could work that out for you. Regards, Surya
Hi Danny, A quick reply could be, if you are using conditions in the WHERE clause try moving them to the Left Outer join . Try this out and let me know, as Conditions in WHERE Clause would result in INNER JOIN based on the conditions you have inputted in the WHERE Clause
Thanks everyone for quick responses but Where clause was causing the issue. I just needed to twick the joins between tables and it worked. Thanks!
If you can post the code it helps to identify the root cause of the issue than suggesting shot in dark.
[quote user="satya"] If you can post the code it helps to identify the root cause of the issue than suggesting shot in dark. [/quote] Issue already resolved, I guess. []
<P mce_keep="true">[quote user="FrankKalis"] <P>[quote user="satya"]</P><P>If you can post the code it helps to identify the root cause of the issue than suggesting shot in dark. </P><P>[/quote] </P><P>Issue already resolved, I guess. <IMG alt=Smile src="http://sql-server-performance.com/Community/emoticons/emotion-1.gif"> <BR></P><P>[/quote]</P><P>But still there may be chance for improvement if posted []</P><P>I would like to see the problamatic and workable query</P>
[quote user="danny123"] Hi there, I have 2 tables with foreign key relationship. I am trying to get all the orders for all the customers.In case customer does not have any order it should still be giving result with Null in order field. I am using Left Outer Join but i am not getting result for the customers who dont have any orders. Any clue? Thanks! [/quote] Post the code you used