Mysql
 sql >> Database >  >> RDS >> Mysql

Come creare una query nidificata?

SELECT  u.*,
        (
        SELECT  COUNT(*)
        FROM    users ui
        WHERE   ui.invited_by_id = u.id
        ) AS cnt
FROM    users u