"jose isaias cabrera" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The PM is the same for the same ProjID because the split is a one to > one > assignment, so that should not happen. So, if there is a case like > this, > the PM has been set wrong. What I would like to have is a total of > the > ProjFund, ProjFund total - invoice total where Split = 'y', invoice > total > where Split = 'y', the first (or last or any of the) PM that Split = > 'y'.
SELECT Class, sum(ProjFund), sum(ProjFund) - sum(case split when 'y' then invoice else 0 end), sum(case split when 'y' then invoice else 0 end), max(case split when 'y' then PM else '' end) from ClassTable group by Class, ProjID; Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users