If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > 'Select' query for orders that do not exist in a date range

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-11-12, 05:44
sncb sncb is offline
Registered User
 
Join Date: Jan 2012
Location: Stuttgart
Posts: 2
'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
Reply With Quote
  #2 (permalink)  
Old 01-11-12, 06:25
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-11-12, 06:29
sncb sncb is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 01-11-12, 10:50
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by sncb View Post
... 112001 to 112008
oh, good luck then
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On