Re: MYSQLI and GROUP BY help - please

[email protected]
Newsgroups php.general
Message-ID <CACOt7mF+KthimVoOs8Vne3Whea6dZdJ4xP5BjpiZF7+58ob9TA@mail.gmail.com>
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 <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.