We could help him if he said what database he is using. Chris. -----Original Message----- From: Kristen G. Thorson [mailto:kthorson@xxxxxxxxxxxxxxxxxxxxxx] Sent: 11 May 2005 15:42 To: Shaw, Chris - Accenture Subject: Re: SQL Date guru in the house? ************************************* This e-mail has been received by the Revenue Internet e-mail service. ************************************* I would try to use inherent date functions as well to calculate date differences. As Chris pointed out, you probably have some sort of to_date() function available. If not, you might be able to concat() the date into a string and compare to a variable date. You also might have some sort of cast() function available that may do it. The thought of trying to get a working statement with the setup you have is giving me a headache. kgt Shaw, Chris - Accenture wrote: >Matthew, > > >Depending on what database, you should have a TO_DATE() or DATE() function >that you can cast your dd/mm/yyyy to a date field in the select statement. > >select to_date(yyyy, mm, dd) mydate > >from dual >where mydate >= '11/05/2005' >and mydate <= '11/04/2005' > >Look in the help files or the manual for the correct syntax/function for the >database your using. > >HTH > >-----Original Message----- >From: mwestern@xxxxxxxxxxx [mailto:mwestern@xxxxxxxxxxx] >Sent: 11 May 2005 07:17 >To: php-general@xxxxxxxxxxxxx >Subject: SQL Date guru in the house? > > >Hi All, > >I have a small problem. > > >I have a project in which someone has got three integer fields for >holding the date. DD, MM, YYYY in an sql database. I now have to >have a page that inputs two dates and select records between those two >dates. > > >If I had a date field in the table it would be fairly simple, but I'm >hoping to do this search/comparison without having to rewrite the >pages/database that has already been designed. > > >Start Date: 11/05/2005 >End Date: 11/04/2005 >SELECT * FROM blah WHERE mm BETWEEN 04 AND 05 AND dd BETWEEN 11 AND 11 >AND yyyy BETWEEN 2005 AND 2005 > >Doesn't work for obvious reasons. Is there any way that I can do >this date comparison I the SQL statement without having a decent date >field? >My apologies as this is australian date format and this list is in the >US I think? >Regards >Matthew > > > > > >************************ > >This message has been delivered to the Internet by the Revenue Internet e-mail service > >************************* > > > ************************ This message has been delivered to the Internet by the Revenue Internet e-mail service ************************* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php