Results 1 to 6 of 6

Thread: Query Help

  1. #1
    Join Date
    May 2013
    Posts
    29

    Unanswered: Query Help

    Hey I'm having trouble with a query. I have fields Date_Recieved, and Date_Mailed. I want to run a query to show the customers who havent returned their surveys within 30 days. Also I have customers who don't have anything in the Date_Received field yet. I wrote this code but it doesn't work

    SELECT *
    FROM Customer
    WHERE [Date Received] is NULL AND [Date Mailed] > (Date() - 30);

    It just shows the null values in the field. Not the other ones where I have recieved the surveys that are 30 days or older.

    Also I tried
    Select * from Customer
    Where [Date Received] is NULL
    And [Date Received] - [Date Mailed] >30;

    And it comes up with nothing

  2. #2
    Join Date
    Dec 2012
    Location
    Logan, Utah
    Posts
    163
    Use OR instead of AND

  3. #3
    Join Date
    May 2013
    Posts
    29
    I want both of those options though to be applied though. Everything that is null and dates that I received that have been more than 30 days

  4. #4
    Join Date
    May 2013
    Posts
    29
    nevermind, it works! Thanks

  5. #5
    Join Date
    Dec 2012
    Location
    Logan, Utah
    Posts
    163
    Quote Originally Posted by MTSPEER View Post
    I want to run a query to show the customers who haven't returned their surveys within 30 days. Also I have customers who don't have anything in the Date_Received field yet.
    Then you need to rethink and rewrite what you really want.

  6. #6
    Join Date
    Dec 2012
    Location
    Logan, Utah
    Posts
    163
    Quote Originally Posted by MTSPEER View Post
    nevermind, it works! Thanks
    Nevermind my last post then. Glad you got it to work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •