102 | | select count (*) from ( |
103 | | with tempTable as (select |
104 | | o.* |
105 | | from organizers o |
106 | | join reviews as r on |
107 | | r.organizer_id = o.user_id and |
108 | | r.rating > 3 |
109 | | group by o.user_id) |
110 | | select |
111 | | t.* |
112 | | from events as e |
113 | | join tempTable as tt on |
114 | | tt.user_id = e.organizer_id |
115 | | join offers as o2 on |
116 | | o2.event_id = e.id |
117 | | join transactions as t on |
118 | | t.offer_id = o2.id |
119 | | ) as temp |
| 102 | select c.id_user, r.rating, count(t.id_transaction) |
| 103 | from customer c join review r on c.id_user =r.id_user_customer |
| 104 | join cart c2 on c.id_user =c2.id_user_customer |
| 105 | join transactions t on c2.id_user_customer =t.id_user_customer |
| 106 | where r.rating >7 |
| 107 | group by c.id_user, r.rating |