Write a query to count the number of ranked males per month in each group.
{{{select malegroupmonth.grp, malegroupmonth.date, count(*)
- from (select distinct
- members.sname as sname
- , members.grp as grp , date_trunc('month', members.date)::date as date
- from biograph
- join members on (members.sname = biograph.sname) join rankdates on (rankdates.sname = biograph.sname)
- -- Date_trunc on rankdates.ranked -- is totally unnecessary -- but how can I resist showing off my sql-fu? and date_trunc('month', members.date)
<= date_trunc('month', rankdates.ranked))
- as malegroupmonth
}}}
