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
--user_id, boss_user_id, payment with db as ( select distinct employee_id as user_id, manager_id as boss_user_id, salary as payment from employees ) select t1.user_id from db t1 cross join t2 where t1.boss_user_id = t2.user_id and coalesce(t1.payment, 0) > coalesce(t2.payment, 0)

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

Copy Clear