SQL command

  • SELECT RECID,BranchRECID,ScheduleContinueS,EndDate

    FROM tblBranch_Schedule

    WHERE DATEDIFF(DAY,StartDate,GETDATE()) > 0 AND DATEDIFF(DAY,GETDATE(),EndDate) >= 0

    AND DATEDIFF(DAY,GETDATE(),EndDate) <=15 AND EXISTS (SELECT RECID,BranchRECID,ScheduleContinueS,EndDate

    FROM tblBranch_Schedule

    WHERE DATEDIFF(DAY,GETDATE(),StartDate) > 0);

    SELECT RECID,BranchRECID,ScheduleContinueS,EndDate,DATEDIFF(DAY,GETDATE(),StartDate)

    FROM tblBranch_Schedule

    where DATEDIFF(DAY,GETDATE(),StartDate) > 0 AND DATEDIFF(DAY,GETDATE(),StartDate) <30;

    I want to get the first sql result and then need to which not match in the second sql result

  • ying7690 (6/14/2011)


    SELECT RECID,BranchRECID,ScheduleContinueS,EndDate

    FROM tblBranch_Schedule

    WHERE DATEDIFF(DAY,StartDate,GETDATE()) > 0 AND DATEDIFF(DAY,GETDATE(),EndDate) >= 0

    AND DATEDIFF(DAY,GETDATE(),EndDate) <=15 AND EXISTS (SELECT RECID,BranchRECID,ScheduleContinueS,EndDate

    FROM tblBranch_Schedule

    WHERE DATEDIFF(DAY,GETDATE(),StartDate) > 0);

    SELECT RECID,BranchRECID,ScheduleContinueS,EndDate,DATEDIFF(DAY,GETDATE(),StartDate)

    FROM tblBranch_Schedule

    where DATEDIFF(DAY,GETDATE(),StartDate) > 0 AND DATEDIFF(DAY,GETDATE(),StartDate) <30;

    I want to get the first sql result and then need to which not match in the second sql result

    Lookup EXCEPT and FULL OUTER JOIN in Books Online for two different ways to do this.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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