June 14, 2011 at 7:36 pm
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
June 14, 2011 at 10:59 pm
ying7690 (6/14/2011)
SELECT RECID,BranchRECID,ScheduleContinueS,EndDateFROM 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
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply