I have 14 queries, such as
select activities.type, sum(activity_fees.amount)
from activity_fees inner join activities
on activity_fees.activity_id = activities.id
where DATE(activities.due_at) = current_date - INTERVAL '1 day'
group by activities.type
SELECT avg(activities.rating)
FROM fellows
inner join auth on a.a_id = f.id
inner join activities on activities.fellow_id = fellows.id
WHERE f.type in ('x', 'y', 'z')
and auth.deactivated = false
and DATE(activities.due_at) = current_date - INTERVAL '1 day'
and activities.rating is not null
I am trying to run all the queries at once using a GUI. UNION and UNION ALL can only be used when the no of columns are same in the queries?
When I was using Toad I could run the sql queries if I include a delimiter such as ;
I am not sure how this can be done in postgresql?
Thank you.