Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2012
    Location
    Stuttgart
    Posts
    2

    Unanswered: 'Select' query for orders that do not exist in a date range

    Hi All,

    Im new to this forum and new to SQL as well.

    Could anyone assist me with this request. Im trying to get all the suppliers that do not have an order in the last week that just went by.

    I need to get the select, from and where statements.

    Assume table is called 'Orders'

    Supplier Orddate
    E 21/12/2011
    Y 22/12/2011
    E 23/12/2011
    V 24/12/2011
    E 25/12/2011
    F 26/12/2011
    T 27/12/2011
    Z 28/12/2011
    E 29/12/2011
    H 30/12/2011
    E 31/12/2011
    K 01/01/2012
    Y 02/01/2012
    O 03/01/2012
    Q 04/01/2012
    H 05/01/2012
    D 06/01/2012
    F 07/01/2012
    S 08/01/2012
    Z 09/01/2012
    C 10/01/2012

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    how is "the last week that just went by" defined?

    does your week start on sunday? did you want january 1st through 7th?

    or did you mean the last seven days, like january 3rd through 10th?

    oh, and by the way, we cannot do this if your "orddate" column isn't an actual DATE column -- from here it looks like it can only be VARCHAR
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2012
    Location
    Stuttgart
    Posts
    2
    Thanks for the quick reply.

    To answer your questions:

    1. The date range is actually the between Jan 1 and Jan 8th.

    2. The date format is julian, so its 112001 to 112008

    Thanks again

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by sncb View Post
    ... 112001 to 112008
    oh, good luck then
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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