• tshad (8/20/2012)


    I have 2 tables in my database and am RIGHT JOINING the tables and it is acting like an inner join

    SELECT [DealerCode]

    ,iis.[ForecastSegmentId]

    ,fs.ForecastSegmentId

    ,[Name]

    FROM [dbo].[Sales] iis

    RIGHT OUTER JOIN dbo.Forecast fs ON fs.ForecastId = iis.ForecastId

    WHERE dealercode = '11'

    GROUP BY DealerCode,iis.ForecastId,fs.ForecastId,Name

    And I come out with all the rows from the 1st table (Sales).

    DealerCodeForecastIdForecastIdName

    001144Dual

    001155Mortgage

    001166Retail

    But in the 2nd table have 3 more records (7, 8, and 9).

    Where are those???

    I tried this with Left and Right Joins as well as Full.

    Still didn't get the extra records.

    This should be pretty straight forward.

    Any ideas what I am missing???

    Thanks,

    Tom

    Hi Tom,

    Can you please provide DDL and sample records of the tables ?

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂