← Back to team overview

maria-discuss team mailing list archive

Re: Bug in MAX() function?

 

Hi Kristian

> Maybe try something like this (untested):
> 
> SELECT *
>   FROM (SELECT mail_out_anon+mail_out_auth ss, timeslice
>           FROM domaincounters
>          WHERE domain_id=19
>          ORDER BY timeslice desc
>          LIMIT 24) tmp
>  ORDER BY ss DESC
>  LIMIT 1;

Thank you, that is the solution I was looking for.

Justin, you cannot have a subquery on the same table within your query. My 
previous attempt was to return the ID's of the last 24 timeslices in a 
subquery and then MAX() them. But MariaDB prevents this kind of query.

Mit freundlichen Grüssen

Benoit Panizzon
-- 
I m p r o W a r e   A G    -    
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 07
CH-4133 Pratteln                Fax  +41 61 826 93 02
Schweiz                         Web  http://www.imp.ch
______________________________________________________


Follow ups

References