Re: Select Query problem

From: Date: Mon, 06 Oct 2003 07:02:17 +0000
Subject: Re: Select Query problem
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-165144@lists.php.net to get a copy of this message
>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?? On Mon, 06 Oct 2003 07:30:26 +0100, David Otton <phpmail@jawbone.freeserve.co.uk> wrote: This question isn't on-topic for this list; it's about SQL, not PHP. You'll get a better response on a mailing list for users of your DB. You also didn't mention which database you're using. However, assuming MySQL I'd start by looking at the MONTH() function. Something like SELECT * FROM table WHERE MONTH(date_column) = 10; (untested). Oh yah, sorry forgotten which database I'm using. Anyway, will be using mysql. ..... Regards, Irin. >>>>>By the way, I don't tink it will work using the month() function. As you have quote: SELECT * FROM table WHERE MONTH (date_column)=10; The above will only display the column where the month is equal to "OCTOBER"(10). What I meant is that it can actually display all data that is in the "CUURENT MONTH" as well as the previous last 11 months. Example: The current month is october, and so by right it should display the data that are in the current month(Oct'2003), as well as the last 11 months (Nov'02-Sept'03)...How should the select query statement be like???? Regards, Irin.

« previous php.general (#165144) next »