Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. SELECT artists.user_id, artists.staff_id,
  2. Sum(events.sum),
  3. Sum(goods.sum),
  4. FROM artists
  5. INNER JOIN `events` ON `artists`.`id` = `events`.`artist_id`
  6. INNER JOIN `goods` ON `artists`.`id` = `goods`.`artist_id`
  7. WHERE (`events`.`created_at` BETWEEN '2017-01-01' AND '2017-07-30')
  8. AND (`goods`.`created_at` BETWEEN '2017-01-01' AND '2017-07-30')
  9. GROUP BY artists.user_id, artists.staff_id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement