Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
create table tbl (id int, price int); insert into tbl values (1, 10),(1, 20), (2, 10),(2, 15),(2, 20),(2, 15), (3, 10),(3, 100), (4, 1),(4, 2),(4, 3), (5, 1010); SELECT id, SUM(price) sum_price FROM tbl GROUP BY id ORDER BY sum_price DESC;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear