| 164 | | select c.id_cinema as id,f.id_film as film,sum(t.price) as sum1 from cinemas c |
| 165 | | join projection_rooms pr on pr.id_cinema=c.id_cinema |
| 166 | | join projection_is_played_in_room pipir on pipir.id_room=pr.id_room |
| 167 | | join projections p on p.id_projection=pipir.id_projection |
| 168 | | join films f on f.id_film=p.id_film |
| 169 | | join tickets t on t.id_projection=p.id_projection |
| 170 | | where t.date_reserved between now()-interval'3 months' and now() |
| 171 | | group by c.id_cinema,f.id_film |
| | 164 | select c.id_cinema as id,f.id_film as film,sum(t.price) as sum1 from cinemas c |
| | 165 | join projection_rooms pr on pr.id_cinema=c.id_cinema |
| | 166 | join projection_is_played_in_room pipir on pipir.id_room=pr.id_room |
| | 167 | join projections p on p.id_projection=pipir.id_projection |
| | 168 | join films f on f.id_film=p.id_film |
| | 169 | join tickets t on t.id_projection=p.id_projection |
| | 170 | where t.date_reserved between now()-interval'3 months' and now() |
| | 171 | group by c.id_cinema,f.id_film |
| 181 | | select count(distinct t1.id_ticket) from tickets t1 |
| 182 | | join projections p on p.id_projection=t1.id_projection |
| 183 | | join projection_is_played_in_room pipir on pipir.id_projection=p.id_projection |
| 184 | | join projection_rooms pr on pr.id_room=pipir.id_room |
| 185 | | join cinemas cin on cin.id_cinema=pr.id_cinema |
| 186 | | where cin.id_cinema=c2.id_cinema and t1.id_customer=c.id_customer) |
| | 180 | select count(distinct t1.id_ticket) from tickets t1 |
| | 181 | join projections p on p.id_projection=t1.id_projection |
| | 182 | join projection_is_played_in_room pipir on pipir.id_projection=p.id_projection |
| | 183 | join projection_rooms pr on pr.id_room=pipir.id_room |
| | 184 | join cinemas cin on cin.id_cinema=pr.id_cinema |
| | 185 | where cin.id_cinema=c2.id_cinema and t1.id_customer=c.id_customer) |
| 189 | | select sum(t1.price) from tickets t1 |
| 190 | | join projections p on p.id_projection=t1.id_projection |
| 191 | | join projection_is_played_in_room pipir on pipir.id_projection=p.id_projection |
| 192 | | join projection_rooms pr on pr.id_room=pipir.id_room |
| 193 | | join cinemas cin on cin.id_cinema=pr.id_cinema |
| 194 | | where cin.id_cinema=c2.id_cinema and t1.id_customer=c.id_customer) |
| | 188 | select sum(t1.price) from tickets t1 |
| | 189 | join projections p on p.id_projection=t1.id_projection |
| | 190 | join projection_is_played_in_room pipir on pipir.id_projection=p.id_projection |
| | 191 | join projection_rooms pr on pr.id_room=pipir.id_room |
| | 192 | join cinemas cin on cin.id_cinema=pr.id_cinema |
| | 193 | where cin.id_cinema=c2.id_cinema and t1.id_customer=c.id_customer) |
| 197 | | select count(distinct d.id_discount) from discounts d |
| 198 | | join tickets t1 on t1.id_discount = d.id_discount |
| 199 | | join projections p on p.id_projection=t1.id_projection |
| 200 | | join projection_is_played_in_room pipir on pipir.id_projection=p.id_projection |
| 201 | | join projection_rooms pr on pr.id_room=pipir.id_room |
| 202 | | join cinemas cin on cin.id_cinema=pr.id_cinema |
| 203 | | where cin.id_cinema=c2.id_cinema and t1.id_customer=c.id_customer |
| | 196 | select count(distinct d.id_discount) from discounts d |
| | 197 | join tickets t1 on t1.id_discount = d.id_discount |
| | 198 | join projections p on p.id_projection=t1.id_projection |
| | 199 | join projection_is_played_in_room pipir on pipir.id_projection=p.id_projection |
| | 200 | join projection_rooms pr on pr.id_room=pipir.id_room |
| | 201 | join cinemas cin on cin.id_cinema=pr.id_cinema |
| | 202 | where cin.id_cinema=c2.id_cinema and t1.id_customer=c.id_customer |
| 220 | | select count(distinct t.id_ticket) from tickets t |
| 221 | | left join projections p on p.id_projection=t.id_projection |
| 222 | | left join films f1 on f1.id_film=p.id_film |
| 223 | | where f.id_film=f1.id_film |
| 224 | | ),0), |
| 225 | | coalesce(( |
| 226 | | select sum(t.price) from tickets t |
| 227 | | left join projections p on p.id_projection=t.id_projection |
| 228 | | left join films f1 on f1.id_film=p.id_film |
| 229 | | where f.id_film=f1.id_film |
| 230 | | ),0), |
| 231 | | coalesce(( |
| 232 | | select count(distinct c.id_customer) from customers c |
| 233 | | left join tickets t2 on t2.id_customer=c.id_customer |
| 234 | | left join projections p on p.id_projection=t2.id_projection |
| 235 | | left join films f1 on f1.id_film=p.id_film |
| 236 | | where f.id_film=f1.id_film |
| 237 | | ),0), |
| 238 | | coalesce(( |
| 239 | | select count(crf.rating) from customer_rates_film crf |
| 240 | | left join films f2 on f2.id_film=crf.id_film |
| 241 | | where f2.id_film=f.id_film |
| | 220 | select count(distinct t.id_ticket) from tickets t |
| | 221 | left join projections p on p.id_projection=t.id_projection |
| | 222 | left join films f1 on f1.id_film=p.id_film |
| | 223 | where f.id_film=f1.id_film |
| | 224 | ),0), |
| | 225 | coalesce(( |
| | 226 | select sum(t.price) from tickets t |
| | 227 | left join projections p on p.id_projection=t.id_projection |
| | 228 | left join films f1 on f1.id_film=p.id_film |
| | 229 | where f.id_film=f1.id_film |
| | 230 | ),0), |
| | 231 | coalesce(( |
| | 232 | select count(distinct c.id_customer) from customers c |
| | 233 | left join tickets t2 on t2.id_customer=c.id_customer |
| | 234 | left join projections p on p.id_projection=t2.id_projection |
| | 235 | left join films f1 on f1.id_film=p.id_film |
| | 236 | where f.id_film=f1.id_film |
| | 237 | ),0), |
| | 238 | coalesce(( |
| | 239 | select count(crf.rating) from customer_rates_film crf |
| | 240 | left join films f2 on f2.id_film=crf.id_film |
| | 241 | where f2.id_film=f.id_film |
| 250 | | select count(distinct w.id_worker) from workers w |
| 251 | | left join cinemas c1 on c1.id_cinema=w.id_cinema |
| 252 | | where c1.id_cinema=c.id_cinema |
| 253 | | ),0), |
| 254 | | coalesce(( |
| 255 | | select sum(s.sum) from salaries s |
| 256 | | left join workers w2 on s.id_worker=w2.id_worker |
| 257 | | left join cinemas c1 on c1.id_cinema=w2.id_cinema |
| 258 | | where c1.id_cinema=c.id_cinema and s.date_to is null |
| | 250 | select count(distinct w.id_worker) from workers w |
| | 251 | left join cinemas c1 on c1.id_cinema=w.id_cinema |
| | 252 | where c1.id_cinema=c.id_cinema |
| | 253 | ),0), |
| | 254 | coalesce(( |
| | 255 | select sum(s.sum) from salaries s |
| | 256 | left join workers w2 on s.id_worker=w2.id_worker |
| | 257 | left join cinemas c1 on c1.id_cinema=w2.id_cinema |
| | 258 | where c1.id_cinema=c.id_cinema and s.date_to is null |