Re: Between Query (0T)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* andreja@xxxxxxxxxxxxxx <andreja@xxxxxxxxxxxxxx> :
> I am not sure
> but maybe something like this is posible
>
> $current_year = date(Y);
> $qry = "SELECT * FROM
>  `table`
>  WHERE ($current_year-YEAR(birthday))  BETWEEN 25 AND 26"


No -- because this incorrectly identifies somebody born on June 14 as 26
even though today is May 9, and they're still 25.


> "Matthew Weier O'Phinney" <matthew@xxxxxxxxxx> wrote in message 
> news:slrnd7sdct.2h3.matthew@xxxxxxxxxxxxxxxxxxxxxxxx
> > * Ryan A <ryan@xxxxxxxxxxxx> :
> > > Thanks for replying.
> > >
> > > > SELECT * FROM
> > > > `table`
> > > > WHERE `age` BETWEEN 25 AND 26;
> > >
> > > I knew the above, but how do i use it with my date field when i have
> > > birthdates like this:
> > > 01-01-1969
> > > and 03-05-1955

-- 
Matthew Weier O'Phinney           | WEBSITES:
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org
mailto:matthew@xxxxxxxxxx         | http://vermontbotanical.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux