On 22-12-2013 08:55, Giuseppe Costanzi wrote:
I don't know if I have understood well but the statment

SUM(stats.quantity * (stats.which_month = 1))
SUM(stats.quantity * (stats.which_month = 2))

should be interpreted

SUM stats.quantity IF stats.which_month = 1 is TRUE


The original '(stats.which_month = 1)' equals to 1 if the month is january and to 0 if the month is not january

so, this:
> SUM(stats.quantity * (stats.which_month = 1))

can be read as:
SUM(CASE WHEN stats.which_month = 1 THEN stats.quantity ELSE 0 END)


Am'I still in the darkness?

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to