Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select users.id, users.email,
- COUNT(distinct orders.oid) as orders,
- COUNT(distinct travellers.tid) as travellers
- from users
- left join orders on users.id = orders.userid
- left join travellers on users.id = travellers.userid
- where users.email = @email
- group by users.id, users.email
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement