TSQL2sDay #37 JOIN



Well this is quiet a request for our T-SQL Tuesday. This is to JOIN someone who is already writing a post a day this month all related to JOIN. WOW! I had no idea there was so much to talk about. So if you are JOIN curious like me check this out:

A Join A Day

This T-SQL Tuesday invite is part of my December 2012 “A Join A Day” blog post series. You can find the table of contents with all posts published so far in the introductory post: A Join A Day – Introduction.

Any way back to business this month is hosted by sqlity.net. What a great suggestion!

Here we are ending the year with a TSQL Tuesday all about JOIN. How cute that December is filled with holidays and it is more than likely you will JOIN others to celebrate. Well I for one am going to take a little bit of an off-beat approach with my JOINing in on this topic. I want to share a little humor and hopefully you can JOIN me for a little laugh.  I want to tell you about the unofficial study that we conducted in my office. We asked everyone about how they like to JOIN things and if they ever actually used a RIGHT JOIN. You may not be surprised to learn that our results show everyone here uses LEFT JOIN and will rearrange the table order to prevent breaking out the RIGHT JOIN. When we asked folks to JOIN in on our conversation and tell us why they prefer the LEFT JOIN most people said it baked their brain to work in the other direction and that it was hard to visualize. While everyone admitted they understood the difference and knew how to work with it they all seemed to just prefer it LEFT JOIN. Interesting as most people are right handed in my office. I guess we are right handed and LEFT JOINED. 😉

I can take my LEFT obsession just a tick farther. When I am writing a query that is going to require several joins I tend to start with the LEFT most table (the originating point of data) and work my way down. Yes my filter variable may not be available till table 3 in the list but I like keeping everything orderly. Crazy maybe, but when I go back and look at my code I know generally where to start. However the one exception to the rule is I always put the look up table following. I guess I look at those look up tables as stagnant data that I am only joining to for a pretty display name. Hmmm, and I just figured this out as I was writing this post.

Happy Holidays everyone! Hope you get to JOIN someone important this holiday season.



1 comment to TSQL2sDay #37 JOIN

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="">




This site uses Akismet to reduce spam. Learn how your comment data is processed.