Jump to content

Recommended Posts

ok I have 2 fields in my table, (date1 and date2) with date1 = 2007-08-01 and date2 = 2007-09-30

 

I'm trying to run this sql statement:

 

SELECT * FROM discounts WHERE discType = 'Date Range' AND date1 >= '2007-09-15' AND date2 <= '2007-09-15'

 

and it won't return any rows...

 

is there a way to see if a date is between 2 days in a table? (btw.. 'Date Range' is valid.. so thats not it)

ok I have 2 fields in my table, (date1 and date2) with date1 = 2007-08-01 and date2 = 2007-09-30

 

I'm trying to run this sql statement:

 

SELECT * FROM discounts WHERE discType = 'Date Range' AND date1 >= '2007-09-15' AND date2 <= '2007-09-15'

 

and it won't return any rows...

 

if date1 = 2007-08-01 there will be no records where date1>=2007-09-15.

if date2 = 2007-09-30 there will be no records where date2<=2007-09-15

I would expect your query to return zero rows.

 

I assume I've failed to understand what you want to happen.

 

Your example seems at odds with trying to determine if a date lies BETWEEN two values (and BETWEEN was the subject of the link I gave)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.