17 | | == Да се најдат каков тип на Артисти ангажирал Организаторот во последните 6 месеци. |
18 | | |
19 | | {{{#!sql |
20 | | select distinct at2.name from |
21 | | ( |
22 | | select o2.artist_id from users u |
23 | | join organizers o on |
24 | | o.user_id = u.id |
25 | | join events e on |
26 | | e.organizer_id = o.user_id |
27 | | join offers o2 on |
28 | | o2.event_id = e.id |
29 | | where e.organizer_id = 11 |
30 | | and o2.completed_at notnull and o2.status = 2 |
31 | | ) |
32 | | as artists |
33 | | join artists a on |
34 | | artists.artist_id = a.user_id |
35 | | join artist_types at2 on |
36 | | at2.id = a.artist_type_id; |
| 17 | == Да се најдат каков тип на Артисти ангажирале Организаторите во последните 6 месеци. |
| 18 | |
| 19 | {{{#!sql |
| 20 | select |
| 21 | o.user_id as organizer_id, |
| 22 | at2.name |
| 23 | from organizers o |
| 24 | left join events e on e.organizer_id = o.user_id |
| 25 | left join offers o2 on o2.event_id = e.id |
| 26 | left join artists a on a.user_id = o2.artist_id |
| 27 | join artist_types at2 on at2.id = a.artist_type_id |
| 28 | where |
| 29 | o2.status = 1 and |
| 30 | o2.completed_at between now() - interval '6 months' and now() |
| 31 | group by o.user_id, at2.name |