Need help with a join statement

  • That is because you are using OUTER JOINS.

    FROM [HOSTSQL].[dbo].[IN_RES] sm2

    left outer join IN_GUEST sm1 on sm1.GUESTNUM = sm2.GUESTNUM

    left join IN_PLAYR sm3 on sm3.PIMGPATH = sm2.GUESTNUM

    where sm2.MEMTYPE !=''

    When you use an outer join if there are rows in IN_RES that have no corrisponding row in IN_GUEST you will get the data for IN_RES and any columns from IN_GUEST will be filled in with NULLs. If this is not the results you want then you should use INNER JOINs or just JOIN.

    Kenneth

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • Thanks for the assistance. Greatly appreciated.

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

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