开发者

SQL select where date is a week or younger

开发者 https://www.devze.com 2023-04-05 09:24 出处:网络
I need to select records that are a week or less in age, by this column: dbo.mod_employmentAppProfile.dateSubmitted

I need to select records that are a week or less in age, by this column: dbo.mod_employmentAppProfile.dateSubmitted

Note, the #arguments.departmentID# is a coldfusion tag.

Here's my query:

    SELECT
        dbo.pro_Profile.profileID, 
        dbo.pro_Profile.firstName, 
        dbo.pro_Profile.lastName, 
        dbo.pro_Profile.isDeleted, 
        dbo.pro_Email.emailAddress, 
        dbo.mod_employmentAppJobTitles.supervisorID, 
        dbo.mod_employmentAppJobs.appID, 
        dbo.mod_employmentAppJobs.isRejected, 
        dbo.mod_employmentAppJobs.isDeleted AS isDeletedJobs, 
        dbo.mod_employmentAppJobs.emailSent, 
        dbo.mod_employmentAppProfile.dateAvailable, 
        dbo.mod_employmentAppProfile.dateSubmitted, 
        dbo.mod_employmentAppProfile.firstName AS appFirstName,
        dbo.mod_employmentAppProfile.lastName AS appLastName, 
        dbo.mod_employmentAppJobTitles.title, 
        dbo.mod_employmentAppProfile.name, 
        dbo.mod_employmentApp开发者_如何学JAVAProfile.phone, 
        dbo.mod_employmentAppProfile.major, 
        dbo.mod_employmentAppProfile.minor
    FROM dbo.pro_Email 
        INNER JOIN dbo.pro_Profile 
            ON dbo.pro_Email.profileID = dbo.pro_Profile.profileID 
        INNER JOIN dbo.mod_employmentAppJobs 
        INNER JOIN dbo.mod_employmentAppJobTitles 
            ON dbo.mod_employmentAppJobs.jobTitleID = dbo.mod_employmentAppJobTitles.jobTitleID 
        INNER JOIN dbo.mod_employmentAppProfile 
            ON dbo.mod_employmentAppJobs.eAppID = dbo.mod_employmentAppProfile.eAppID 
            ON dbo.pro_Profile.profileID = dbo.mod_employmentAppJobTitles.supervisorID
    WHERE (dbo.mod_employmentAppJobs.emailSent = 0) 
            AND (dbo.mod_employmentAppJobTitles.departmentID = #arguments.departmentID#)
            AND (dbo.mod_employmentAppJobs.isRejected = 0)

I did try something like:

                 and (dbo.mod_employmentAppProfile.dateSubmitted < DATEADD(day, - 7, GETDATE()))

which returns no results.

Suggestions?


try

(dbo.mod_employmentAppProfile.dateSubmitted > DATEADD(day, -7, GETDATE()))

0

精彩评论

暂无评论...
验证码 换一张
取 消