On Sun, 2007-07-01 at 22:45 +1200, Gordon Stewart wrote:
> ORDER BY `montha` DESC,
>
> Hi, my month column/field is YYYYMM format...
>
> The above is part of a MYSQL query...I know I can use limit 5 -
> however that will get me 5 rows of data....is there a way to limit by
> 5 months of data ??
>
> EG :- (UNIQUE (ORDER BY `montha` DESC) Limit 5) - Tried that - gave
> errors....
I don't think that you can do anything like that. The only thing that I
know of is add those to your where clause.
$today=date("Ym");
$limitDate=date("Ym",mktime(0,0,0,date("m")-5,date("d"),date("Y"));
... WHERE `montha` >= '$limitDate' AND `montha` <= '$today' ...
By doing this you can adjust the range you are selecting, it doesn't
have to be the last 5 months.
HTH,
--
Doug
Registered Linux User #285548 (http://counter.li.org)
----------------------------------------
Random Thought:
Our POP server was kidnapped by a weasel.