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 > [query] Specific Date between 2 dates

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-29-05, 04:37
TheWock TheWock is offline
Registered User
 
Join Date: Nov 2005
Posts: 5
[query] Specific Date between 2 dates

Hi,

I've got a table which containts the following fields
DossierID, Datum_start, Datum_end

When I want to select all the DossierID's between 2 dates my query is (for example):
SELECT dossierID
FROM table
where Datum_start > 2005-01-01 and Datum_end < 2005-05-01

However, Let's say I've got the following situation:

Dossierid= 8
Datum_start = 2005-01-01
Datum_end = 2005-05-01

I want to see which DossierID is active on 2005-03-08, the result of the query should be the above result. My question is, what should the query be?
Reply With Quote
  #2 (permalink)  
Old 11-29-05, 05:38
felixg felixg is offline
Registered User
 
Join Date: Apr 2005
Location: Lier, Belgium
Posts: 122
Quote:
Originally Posted by TheWock
However, Let's say I've got the following situation:

Dossierid= 8
Datum_start = 2005-01-01
Datum_end = 2005-05-01

I want to see which DossierID is active on 2005-03-08, the result of the query should be the above result. My question is, what should the query be?

Code:
SELECT
    DossierID
FROM table
WHERE
    '2005-03-08' BETWEEN Datum_start AND Datum_end;
--
felix
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