Re: MYSQLI and GROUP BY help - please
| From: | gordonisnz at gmail dot com | Date: | Fri, 26 Aug 2022 10:22:48 +0000 |
| Subject: | Re: MYSQLI and GROUP BY help - please | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-328047@lists.php.net to get a copy of this message | ||
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@gmail.com> 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
dailycolonystatsf‚2é¦ldhÇ$�
> ™£y
> 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