Home > Archive > MySQL Server Forum > June 2005 > Current Month









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 Current Month
Gary

2005-06-06, 8:23 pm

How do you get the current month - 1 month?

(so not a particular day, but the whole month)

Thanks,

Gary


Aggro

2005-06-06, 8:23 pm

Gary wrote:
> How do you get the current month - 1 month?
>
> (so not a particular day, but the whole month)


Functions you need:
CURDATE()
SUBDATE()
MONTH()

Manual where you can learn how to use them:
http://dev.mysql.com/doc/mysql/en/d...-functions.html
Chris Hope

2005-06-06, 8:23 pm

Gary wrote:

> How do you get the current month - 1 month?
>
> (so not a particular day, but the whole month)


SELECT MONTH(SUBDATE(NOW(),
INTERVAL 1 MONTH))

The date and time functions can be found in the manual here:
http://dev.mysql.com/doc/mysql/en/d...-functions.html

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Gary

2005-06-06, 8:23 pm

Great, thanks, follow-up question, how can it apply to a column which isn't
called month? i.e. I want to view the records in column A where the month is
month-1
"Chris Hope" < blackhole@electricto
olbox.com> wrote in message
news:d82dqr$mr6$1@lu
st.ihug.co.nz...
> Gary wrote:
>
>
> SELECT MONTH(SUBDATE(NOW(),
INTERVAL 1 MONTH))
>
> The date and time functions can be found in the manual here:
> http://dev.mysql.com/doc/mysql/en/d...-functions.html
>
> --
> Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com



Gary

2005-06-06, 8:23 pm

Never mind, the link below answered it, thanks for your help!


"Gary" <gary@aviatorwebsite.com> wrote in message
news:%g3pe.101730$w15.78455@tornado.tampabay.rr.com...
> Great, thanks, follow-up question, how can it apply to a column which
> isn't called month? i.e. I want to view the records in column A where the
> month is month-1
> "Chris Hope" < blackhole@electricto
olbox.com> wrote in message
> news:d82dqr$mr6$1@lu
st.ihug.co.nz...
>
>



Sponsored Links





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

Copyright 2009 droptable.com