Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- IFNULL(s.film_id, 'Итого') id,
- COUNT(*) AS total_all_time,
- COUNT(*) / COUNT(DISTINCT b.seans_id) AS avg_buyed,
- SUM(s.price) AS total_price
- FROM seans s
- JOIN bilet b ON s.id = b.seans_id
- GROUP BY s.film_id WITH ROLLUP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement