Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgresql must appear in the group by clause or be used in an aggregate function

Try using "DISTINCT" instead of "GROUP BY"
Comment

column 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
Comment

PREVIOUS NEXT
Code Example
Sql :: sql injection 
Sql :: creating database with - 
Sql :: sql insert 
Sql :: connect laravel to mysql on mac 
Sql :: sql queries practice 
Sql :: what is 1=2 in sql 
Sql :: sql delete dastabase 
Sql :: mysql curdate between two dates 
Sql :: right join 
Sql :: equi join in sql 
Sql :: sql 
Sql :: like operator in sql 
Sql :: create domain sql 
Sql :: SELECT SQL LIKE 
Sql :: plpgsql 
Sql :: mysql create database 
Sql :: select from table and insert into table in sql 
Sql :: specify regex check on column constraint sqlalchemy 
Sql :: increase space oracle aws instance 
Sql :: cronjob mysql backup 
Sql :: how to select only first 3 characters in sql 
Sql :: mysql config address 
Sql :: naming conventions postgres index 
Sql :: clauses in mysql 
Sql :: sql server search all databases for objects 
Sql :: mysql aspas simples 
Sql :: Postgresql select join by date - Join rows where a timestamp value is equal to midnight of the date 
Sql :: postgres another version 
Sql :: mysql check if entry exists 
Sql :: order records between two cordinates sql 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =