equivalent to DISTINCT ON (with SUM()) for in-memory SQLite

2016-01-07 Thread Dr. Hawkins
I need to sum amounts and return keys where other fields are the same on an in-memory database. I have my own unique key uniqDna, fields cname and cadr, and numeric field due I want to SUM(due) for each unique cname||cadr, and get get the corresponding keys. DISTINCT ON would due this, but it's

Re: equivalent to DISTINCT ON (with SUM()) for in-memory SQLite

2016-01-07 Thread Peter Haworth
I think this will work SELECT sum(due) from mytable WHERE ORDER BY cname || caddr GROUP BY cname || caddr GROUP may have to come before ORDER, don't remember. On Thu, Jan 7, 2016 at 4:32 PM Dr. Hawkins wrote: > I need to sum amounts and return keys where other fields are