On Fri, Jul 31, 2015 at 7:40 AM, Simon Slavin <slavins at bigfraud.org> wrote:
> > On 31 Jul 2015, at 1:26pm, John McKown <john.archie.mckown at gmail.com> > wrote: > > > WITH summary AS > > ( SELECT var, count(var) as total FROM table GROUP BY key ) > > SELECT a.var, 100*a.var/b.total as percentage FROM table AS a > > INNER JOIN summary AS b ON a.key=b.key > > ORDER BY key > > Thank you at last for an example of non-recursive CTE being useful in the > real world. > > I am noting an overlap with the things SQLite users have been using > sub-SELECTs for. > ?Dang. That should be GROUP BY var, not GROUP BY key. Knew I'd mess up something.? > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > -- Schrodinger's backup: The condition of any backup is unknown until a restore is attempted. Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be. He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown