<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; font-size: 14px; ">Marie,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think this query does it.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Note that I have restricted the dates to just five years to reduce the amount of processing time. Run this query and check some of the results against the handwritten data or against a check of cycpoints. If it works then you can change the dates to cover all the months that you want to check.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think that there were two problems with the previous query:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Main problem: The connection of members.date = cycpoints.date was missing -- we only connected members.sname to cycles.sname. This meant that every date in members was linking to every row in cycpoints where sname matched and it returned thousands of extra lines for every ddate.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Secondary problem: we selected on members.date instead of cycpoints.date. I am not sure whether this was a problem or not but on thinking about it I realized that the date in cycpoints was the relevant date (it was the D date) and not the date in members.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>select count(cycles.cid), members.grp,</DIV><DIV>date_part('month', cycpoints.date) as month,</DIV><DIV>date_part('year', cycpoints.date) as year</DIV><DIV>from cycles, cycpoints, members</DIV><DIV>where cycles.cid = cycpoints.cid and cycles.sname = members.sname</DIV><DIV>and cycpoints.date = members.date</DIV><DIV>and cycpoints.date between '2000-01-01' and '2005-12-31'</DIV><DIV>and cycpoints.code = 'D'</DIV><DIV>group by members.grp, month, year</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Let me know if it works.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Susan</DIV></BODY></HTML>