hi, in addition to the others comments, you can also remove "
ELSE 0 " from your query. It will result in <NULL> values that are discarded by SUM. regards, Marc Mamin From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx]
On Behalf Of janek12@xxxxxx Hi, this is my query: SELECT user, sum(CASE WHEN lev >= 50 AND lev < 70 THEN 1 ELSE 0 END) as a, sum(CASE WHEN lev > 90 THEN 1 ELSE 0 END) as d, I like to add up the 4 columns a,b,c and d of every user, but it doesn't work like this. Does anyone know a solution Janek Sendrowski |