August 1, 2013 at 12:25 pm
I know I'm lost somewhere here but I thought this would get me all client in Rday_All_clients even if a record didn't exist in R_Day ?
SELECT Rday_All_clients.LName, Rday_All_clients.FName, R_Day.OID, R_Day.STARTTIME,
FROM R_Day RIGHT OUTER JOIN
Rday_All_clients ON R_Day.ID = Rday_All_clients.Client_ID
WHERE (R_Day.OID = '140FA7F3F5924873B8A14E369A3CCCBD') AND (R_Day.CAD69 = '1')
ORDER BY Rday_All_clients.LName
August 1, 2013 at 12:41 pm
The problem is that your WHERE clause is converting the OUTER JOIN into an INNER JOIN. Change those conditions to the ON clause and it should work as expected.
August 1, 2013 at 1:07 pm
Thanks so much.. wow I have sooo much to learn...
never thought of using an on with more than one field...
August 1, 2013 at 1:11 pm
Also, you might consider reversing your code and making this a left join. Many people struggle with the concept of a right join because it is backwards for most people.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 1, 2013 at 1:55 pm
Thanks Sean.. good idea
Its one thing I think I do get..
At least I think I do.. lol
August 1, 2013 at 2:27 pm
jbalbo (8/1/2013)
Thanks Sean.. good ideaIts one thing I think I do get..
At least I think I do.. lol
It is exactly like a left join....only backwards. 😛
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 1, 2013 at 2:40 pm
Sean Lange (8/1/2013)
jbalbo (8/1/2013)
Thanks Sean.. good ideaIts one thing I think I do get..
At least I think I do.. lol
It is exactly like a left join....only backwards. 😛
I wonder if left handed people find right outer joins easier. :unsure:
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
August 1, 2013 at 2:45 pm
Alvin Ramard (8/1/2013)
Sean Lange (8/1/2013)
jbalbo (8/1/2013)
Thanks Sean.. good ideaIts one thing I think I do get..
At least I think I do.. lol
It is exactly like a left join....only backwards. 😛
I wonder if left handed people find right outer joins easier. :unsure:
I think they make a left handed version of SSMS for right join folks. 😛
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 1, 2013 at 2:48 pm
I guess you'd be all set if you were ambidextrous...
August 1, 2013 at 2:53 pm
jbalbo (8/1/2013)
I guess you'd be all set if you were ambidextrous...
Full outer joins? :w00t:
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
August 2, 2013 at 7:07 am
Alvin Ramard (8/1/2013)
jbalbo (8/1/2013)
I guess you'd be all set if you were ambidextrous...Full outer joins? :w00t:
I wish this just returned a random value just to mess with people who typed it.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply