Re: more an SQL issue but I can't find any help
| From: | David Robley | Date: | Fri, 20 Apr 2001 07:34:47 +0000 |
| Subject: | Re: more an SQL issue but I can't find any help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49526@lists.php.net to get a copy of this message | ||
On Fri, 20 Apr 2001 17:02, you wrote:
> Yes but how I can "say" 18 years ???
>
> Marian Vasile
> IT Manager
> Schnecker van Wyk & Pearson
> www.investments.ro
> +40 (0) 1 2309000
>
> > -----Original Message-----
> > From: David Robley [mailto:huntsman@www.nisu.flinders.edu.au]
> > Sent: Friday, April 20, 2001 5:31 AM
> > To: Marian Vasile; php-general@lists.php.net
> > Subject: Re: [PHP] more an SQL issue but I can't find any help
> >
> > On Fri, 20 Apr 2001 11:35, Marian Vasile wrote:
> > > I have a table with users and their birthdates.
> > > I want to SELECT all the users who have more than 18 years. How I
> > > can do that using bisect years ? (february 28 days and 29 days)
> > >
> > > plz help ...
> > >
> > > Marian Vasile
> > > IT Manager
> > > Schnecker van Wyk & Pearson
> > > www.investments.ro
> > > +40 (0) 1 2309000
> >
> > Leap years shouldn't be a problem? I don't know what DB you are using
> > or what format you store your dates - but if you can do a query
> > something like
> >
> > SELECT * FROM table WHERE birthdate > (NOW()-18years)
> >
> > using whatever your DB supports for the last bit :-) I _think_ it
> > might work as is with recent MySQL.
Well, it depends on your DB - for Mysql look for the date_sub or subdate
functions; for anything else, you'll have to RTM :-0
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA