I want to merge the following queries to get the answer I want. But I don't seem to get it right.
Query 1:
select a.idlisting, count(p.idpostulant) as Total_postulants
from postulations p
inner join listings a on p.idlisting = a.idlisting
where a.idate >= '2014-07-01'
and a.idate < '2014-08-01'
group by a.idlisting
having total_postulants > 500
With the answer I get from the first query I complete the idlisting clause
**Query 2:**
select count(distinct p.idpostulant)
from postulations p
inner join listings a on p.idlisting = a.idlisting
where a.idlisting in ('1001972582',
'1001964448',
'1001926936')
The answer should be the amount of unique postulants that subscribe to all the listings that have over 500 postulations.
Please let me know if it's understandable.
Thanks for the help.