For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2005 > MySQL Query (off Topic - sorry)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MySQL Query (off Topic - sorry)
Graeme McLaren

2005-06-09, 3:56 pm

Hi all, wondering if anyone can help me out with a mysql query (bit off
topic I know)

select id, title, DATE_FORMAT(auto_enter_date, '%D %b %Y') as date from dci
where auto_enter_date
between ((DATE_SUB(CURDATE(), INTERVAL 90 DAY) and DATE_FORMAT(CURDATE, '%D
%b %Y'));


I want to select the id, title and date between now and the last 3 months,
can anyone show me the correct SQL?


Cheers in advance,

Graeme :)


Jm

2005-06-09, 3:56 pm

select <fields list> from <db.table> where <date_field> >
date_sub(curdate(), interval 3 month);

give that a shot



On 6/9/05, Graeme McLaren <iamnotregistered@hotmail.com> wrote:
> Hi all, wondering if anyone can help me out with a mysql query (bit off
> topic I know)
>=20
> select id, title, DATE_FORMAT(auto_enter_date, '%D %b %Y') as date from d=

ci
> where auto_enter_date
> between ((DATE_SUB(CURDATE(), INTERVAL 90 DAY) and DATE_FORMAT(CURDATE, =

'%D
> %b %Y'));
>=20
>=20
> I want to select the id, title and date between now and the last 3 months=

,
> can anyone show me the correct SQL?
>=20
>=20
> Cheers in advance,
>=20
> Graeme :)
>=20
>=20
>=20
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>=20
>=20
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com