Maybe like:

SELECT something FROM tablename
WHERE date_column >
DATE_SUB(CONCAT(YEAR(NOW()),'-',MONTH(NOW()),'-','01'), INTERVAL @n
MONTH) 

@n is the number of months you want. If you want data from the current
month, @n would be 0.

--
Diana Soares


On Mon, 2003-10-06 at 07:23, [EMAIL PROTECTED] wrote:
> Hi all, 
>        Having a slight problem with mysql select query right here.
> I've learnt that if I were to select a particular data within the last 30 days,
> this is what my select query should be like:
> 
> SELECT something FROM tablename
> WHERE TO_DAYS(NOW(()_TO_DAYS(date_column)<=30;
> 
> (This query selects all records with a 'date_column' value within the last 30 days.)
> 
> Now my question is: What if I would like to display data for the CURRENT MONTH
> and the last 11 months???(May also said to be the LAST MONTHS)
> HOw should my select query be like??
> Hope to receive some help soon.
> Any help given is greatly appreciated.
> 
> Regards, 
> Irin.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to