SQL Joins

  • I have joined 4 tables together and I am losing important data regardless which join I use. The amount does change depends on which I use (clearly) but I want to know what is the best practice for joining tables where you want the least amount of nulls yet get all your data? OR What best practice can I follow that I can utilize when building joins to keep the most of my data?

  • how are you joining your tables ?

    please read this and post back...thanks

    https://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • It's not about one join being better than the other. It's about using the correct join for each query.

    Here's an explanation on how each join works.

    http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (8/9/2016)


    It's not about one join being better than the other. It's about using the correct join for each query.

    Here's an explanation on how each join works.

    http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins

    +1 on this. But remember that there are options other than joins to combine tables. There are also scalar subqueries, CROSS APPLY, OUTER APPLY, UNION, UNION ALL, INTERSECT, and EXCEPT. The most common is, of course, the INNER JOIN, but you need to be aware of the other variations and how they work to determine which is best to use in any given situation.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply