SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
-- Hint: use Ctrl+Enter for SQL autocomplete create table orders ( id int, price int, delivery_price int ); insert into orders values (1, 20000, 500); create table transactions ( id int, order_id int, price int ); insert into transactions values (1, 1, 10000),(2, 1, 10000),(3, 1, 500); select * from orders join ( select order_id, sum(price) paid from transactions group by order_id ) paiments on paiments.order_id = orders.id and orders.price + orders.delivery_price = paiments.paid;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear