On 08-02-2014 11:58, big stone wrote:
with sqlite 3.8.3 (for the with) :
with v(vid,name) as (values (1,'foo'),(1,'bar'),(2,'bar'),(2,'baz'))
select name,
-max(case when vid=1 then 1 else 0 end ) + max(case when vid=2
then 1 else 0 end)
from v group by name
almost the same as this:
with v(vid,name) as (values (-1,'foo'),(0,'bar'),(1,'baz'))
select * from v
;-)
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users