Return rows from table with a join and nulls

  • tshad

    SSCertifiable

    Points: 5839

    I have a table where the status can be a value that is either in a reference table or is null.

    I need to bring back the data that is based on one of three modes.

    If mode is:
    0: only records that have a status of null
    1: only records that have a status of non-null joined with the status table
    2: combination of both: nulls and non-nulls joined with a status table.

    I have no problem with 0 or 1.  But 2, comes back with duplicates for the nulls.

    I can fix the issue using a union but I am trying to do it in one query.  I also looked at using a LEFT JOIN but I that would mean I would get all the records back and then filter it in the WHERE clause.  But there could be tens of thousands of records in the table.

    Here are the results I am looking for:
    data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAP0AAAFfCAYAAACFlsqtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAADKUSURBVHhe7Z1/iCPXle/PxE7i/LLHcRLy/M96sNQhcv3zXsZLkP6KmTceScaIeUYLgSC8f7Tyy+lmkn5keU2WDVoItNeoefvsp/4jQQQCKxYjjLsVzw4O+0eL8Ozw3h81Mh7JO94/1hjyy3bixL/nnXPrlnRLqlJLVSXVrarzAdHSVemW6uqee869Xed7T91AgGGY1PAh+ZdhmJTg6untIg4CGCaenDp1yvFXxWH0X3/s/8FL//GmfMUwTJw4858+Bv/zkXuEoX/oQx9y/FVxGP1//e4xtL97Bu68805Zkl5eeeUVbgeJDm3Bv8cs021C9vtP/+OLcNNNN8HNN988fkwb/nhOz6E8w8Sf3//+9/D666/Dm2++CW+//Ta89957wrZV+2ajZ5gE8etf/1oY/h/+8Ad46623hNF/8MEH8l0LXr1nmAShevp33nkH3n//fXdPv5CXH+1DAecFNDdQH/WefN8Pos4C7I/ka4LKCvugFmnFKtqBUOstYJsErW+dnPSbrew3HUFvv+7sP0RvH+rYgIHOZ/8ejh92BPsF+n0CXsvK2gOEsf/5z38Wof27774rvPy0fS8X3uebMJSjhv1oFeV7vunDdk1jI3cj9HboQT3bgepQ1teuQqdUh94inWOFHUh/MlAs56CTxbaSJaItSx3IlYv4bkDyecib1yZ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xF/6TWV06DAMIye0H0JN910E3zkIx8Rnp48PBk+Gf3HP/5xuPnmm51GT0/IqN99913405/+JP4HSAZPf+k1lbPRM4y+kNGTUZPRk2c/ffq0MPxbb70VPvaxj4kBwdXo33//fXjrrbeEd3/jjTfgj3/8I7z99tvw3nvviUiAYRh9IaMmj05GTiE+eXwaAD760Y8Ko6eBgRgbPf2xvT0Zvv0gg6dyep8Nn2H0xL71mIyb5u+33HKLeJDB02v7fXGsbfQEGTc9yNDth13GMIzeqIZPHt9+UARgGzzhMHp6aj9U704PhmH0xzZ829CnDZ5wGL2NXcTGzjDxxDb0aYMnXI2eYZjkwrfhMkyqAPj/66JGhK4q87cAAAAASUVORK5CYII=

    But here are the results I am getting (the last two rows are duplicate rows).
    data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAAGECAYAAADawaepAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAD8ZSURBVHhe7Z0PkBtXnee/Y8fGOJB4l/1DpViw19JgZGWPK5xsIu1dlsTrWKOQnfNicUXVnirZuhEBzEy8zAHFEIowIaEmZ2a4BTJTu2G1cNyh5MLkz4ywY0LYY8YsiWupQp4QS06cEAIXwuYPCf8S4vv9Xr+WWhq1/rb6j+b3cXW59fr16+7X79fv93r6930DZwgIghAY1un/BUEICHV7WjNJOmFB8IaBgYGq/61UGe17Dn0Pp370ov4lCIKb/PF5m/E/DuxUhsrLunXryutWqoz2L/52Cff+97j+tbZ48skncd555+lfaxs/1MVauh9PP/20Msz//Kkf4Pbroli/fn3VYhqvSXlMK66wIHjDv/3bv+GZZ55R688//zxefPFF/OpXv8JLL72E3/72t8o2rfYpRisIHvPUU0+p3pb5+c9/XmW0r7zyilqsyNtjQfAY7mmfffZZtf6LX/xCGexvfvMbvPzyy6sMllFGW7eXLc0grgfB1iWT19s7QZUZx0xJ/2Y4LT4Da5Kv6EU9MNZy41Qn3ZbnJs3uWc/uaQn5mUx1+2H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93cWBckwb4v/NxdzWCQ17WkEQ3ENC8wShTxGjFQQfYb5Ua/TeqMo9/qvrHsALv3xZbxIEwU02rn8F7/53j5fd4z/4gz9Qk0s3lJsx9Wv4zdazzz6r3uA9//zzaj6dX//610oug/MJguA8bJQ8vw8brXUmeDZa1merMlpe4TdaPNGtKTrFxmq+lv7lL39Znp1ajFYQnMd0idlo+c+rbKy8bNmyRU3YZWu0pvAUG+mLL76oFl7nNN7GeQRB6A1slGycbKSsgnrOOeeoXpZn2LN+H1E2Wv7P7G3NPwCzS8wus2mwnEdnFwTBQcye1nSR2XDNKTHNXnaV0TJsmGaPa7rDVoMVBKF3mIbLvSobKi+8XvsVYpXR8qp1sRqr+b8gCL3DNFyzZ7X2sCZVRmsihioI3mIaaq3BMnWNVhAE/yJfRAlCoAD+P+ziIOp4PPbVAAAAAElFTkSuQmCC


    DECLARE @test TABLE
    (
     EmpName varchar(50),
     EmpStatus VARCHAR(1),
     Job VARCHAR(10),
     YearMonth int
    )

    DECLARE @Status TABLE
    (
     JobStatus VARCHAR(10)
    )

    DECLARE @Mode INT
    SELECT @Mode = 0

    INSERT @Status VALUES('T')
    INSERT @Status VALUES('L')

    INSERT @test Values('John', 'A', 'P', 201801)
    INSERT @test Values('John', 'L', 'P', 201802)
    INSERT @test Values('John', 'L', 'F', 201803)
    INSERT @test Values('John', 'A', 'P', 201804)
    INSERT @test Values('John', 'A', 'F', 201805)
    INSERT @test Values('Mary', 'A', 'F', 201801)
    INSERT @test Values('Mary', 'A', 'F', 201802)
    INSERT @test Values('Mary', 'T', 'F', 201803)
    INSERT @test Values('Mary', 'T', 'P', 201804)
    INSERT @test Values('Mary', 'A', 'F', 201805)
    INSERT @test Values('George', NULL, 'F', 201805)
    INSERT @test Values('Martin', NULL, 'F', 201805)

    WHILE @Mode < 3
    BEGIN

     SELECT t.*
     FROM @test t
     JOIN @Status s
     ON  (@Mode = 0 AND t.EmpStatus IS NULL) OR
      (@Mode = 1 AND t.EmpStatus = s.JobStatus) OR
      (@Mode = 2 AND (t.EmpStatus IS NULL OR t.EmpStatus = s.JobStatus))

     SELECT @Mode = @Mode + 1

    END

    Thanks,

    Tom

  • tshad

    SSCertifiable

    Points: 5839

    Actually the first set also gives duplicates (mode = 0).  It is the nulls that are duplicates.

    I can fix it by using DISTINCT but not sure if that is the best way.

  • SGT_squeequal

    SSCertifiable

    Points: 7061

    you have duplicates in 0, instead of a loop id create use a CTE using Row_number() to eliminate any duplicates

    with cte as
    (
    SELECT t.*,rank() over (partition by isnull(s.JobStatus,t.EmpStatus) order by isnull(s.JobStatus,t.EmpStatus) ) as rn, 1 as mode
    --row_number() over (partition by t.empname,job,yearmonth order by EmpStatus)as rn
    FROM #test t
    left JOIN Status s on s.JobStatus=t.EmpStatus
    where EmpStatus is null
    union all
    SELECT t.*,rank() over (partition by isnull(s.JobStatus,t.EmpStatus) order by isnull(s.JobStatus,t.EmpStatus) ),2
    --row_number() over (partition by t.empname,job,yearmonth order by EmpStatus)as rn
    FROM #test t
    JOIN Status s on s.JobStatus=t.EmpStatus

    union SELECT t.*,rank() over (partition by isnull(s.JobStatus,t.EmpStatus) order by isnull(s.JobStatus,t.EmpStatus) ),3
    --row_number() over (partition by t.empname,job,yearmonth order by EmpStatus)as rn
    FROM #test t
    left JOIN Status s on s.JobStatus=t.EmpStatus
    )select * from cte
    where rn=1
    order by mode

     

     

    ***The first step is always the hardest *******

  • drew.allen

    SSC Guru

    Points: 76493

    The problem here is that you are using an INNER JOIN when you should be using an OUTER JOIN and in trying to emulate an OUTER JOIN, you are creating a (partial) CROSS JOIN.

    Also, I think that you would be better off with three separate queries rather than a loop with a single conditional query even if the query is much more complex than you've shown here.

    DECLARE @test TABLE
    (
    EmpName varchar(50),
    EmpStatus VARCHAR(1),
    Job VARCHAR(10),
    YearMonth int
    )

    DECLARE @Status TABLE
    (
    JobStatus VARCHAR(10)
    )

    DECLARE @Mode INT
    SELECT @Mode = 0

    INSERT @Status VALUES('T')
    INSERT @Status VALUES('L')

    INSERT @test Values('John', 'A', 'P', 201801)
    INSERT @test Values('John', 'L', 'P', 201802)
    INSERT @test Values('John', 'L', 'F', 201803)
    INSERT @test Values('John', 'A', 'P', 201804)
    INSERT @test Values('John', 'A', 'F', 201805)
    INSERT @test Values('Mary', 'A', 'F', 201801)
    INSERT @test Values('Mary', 'A', 'F', 201802)
    INSERT @test Values('Mary', 'T', 'F', 201803)
    INSERT @test Values('Mary', 'T', 'P', 201804)
    INSERT @test Values('Mary', 'A', 'F', 201805)
    INSERT @test Values('George', NULL, 'F', 201805)
    INSERT @test Values('Martin', NULL, 'F', 201805)

    /* Rewritten original code. */
    WHILE @Mode < 3
    BEGIN

    SELECT t.*
    FROM @test t
    LEFT OUTER JOIN @Status s
    ON t.EmpStatus = s.JobStatus
    WHERE (@Mode = 0 AND t.EmpStatus IS NULL) OR
    (@Mode = 1 AND t.EmpStatus = s.JobStatus) OR
    (@Mode = 2 AND (t.EmpStatus IS NULL OR t.EmpStatus = s.JobStatus))

    SELECT @Mode = @Mode + 1

    END

    /* As three separate queries. */
    SELECT t.*
    FROM @test t
    WHERE t.EmpStatus IS NULL

    SELECT t.*
    FROM @test t
    INNER JOIN @Status s
    ON t.EmpStatus = s.JobStatus

    SELECT t.*
    FROM @test t
    LEFT OUTER JOIN @Status s
    ON t.EmpStatus = s.JobStatus
    WHERE t.EmpStatus IS NULL
    OR s.JobStatus IS NOT NULL

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

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

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