Jump to content

[SOLVED] How to get details between the range


gokhul

Recommended Posts

hello,

 

can anyone tell me how to get the result between the range of the following dates.

 

name      age    gender    joiningdate      leavingdate

xxx        10      male      04/23/09        05/22/09

yyy        11    female      01/02/09        08/02/09

zzz        12      male      04/26/09        04/28/09

 

How should I write the select statement such that I can get the details between any two given dates?

 

Please help me.

What type of data is joiningdata and leavingdate? I hope it's of some date format - DATE, TIMESTAMP, etc. I don't think MM/DD/YYYY is a MySQL date-formatted string. I would not use varchar and use TIMESTAMP or DATE or DATETIME. That should help when selecting.

After you change your columns to a DATE data type (the format they are now cannot be directly used in a date comparison) what exactly are you looking for? Provide an example. Are you looking for the values in your table that are completely within two given dates or are you looking to match any that have any overlap at all with two given dates?

Yes..I am looking for the entire details in my database between any two given dates.

 

I have the data in the following format.

 

patient    age    gender      consultdate

1            20      male          04/23/09

2            30      male          04/30/09

3          10        female        05/19/08

 

 

 

Sorry for giving the wrong data above.

Now, If i say the range as 05/19/08 and 04/23/09....i should get all the three results.

 

Can you tell me what should be my select statement.

 

Regards.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.