Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

ERROR: column "hourly_visitors.hour" must appear in the GROUP BY clause or be used in an aggregate function

SELECT m.cname, m.wmname, t.mx
FROM (
    SELECT cname, MAX(avg) AS mx
    FROM makerar
    GROUP BY cname
    ) t JOIN makerar m ON m.cname = t.cname AND t.mx = m.avg
;

 cname  | wmname |          mx           
--------+--------+------------------------
 canada | zoro   |     2.0000000000000000
 spain  | usopp  |     5.0000000000000000
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #column #GROUP #BY #clause #aggregate #function
ADD COMMENT
Topic
Name
4+4 =