Re: MYSQLI and GROUP BY help - please

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you, it does work (on the small number of records I have).
Though I do not know how efficient it is - someone else may need to
answer it,

I'll put it in my script, & update my other reports too, with a similar format.


On Fri, 26 Aug 2022 at 22:14, Aziz Saleh <azizsaleh@xxxxxxxxx> wrote:
>
> Can you try this query (might be a more efficient way to do it):
>
> SELECT dcs.* FROM dailycolonystats dcs,
> (
>   SELECT Grp, Colony, Type, Max(Date) AS date FROM `dailycolonystats`
>   GROUP BY Grp, Colony, Type
> ) as max_dates
> WHERE dcs.Region = 'AUCKLAND'
> AND dcs.date = max_dates.date
> AND dcs.Grp = max_dates.Grp
> AND dcs.Colony = max_dates.Colony
> AND dcs.Type = max_dates.Type



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux