sqlite - retrieve summed amounts from sql -


what problem following query:

select wbcode||yr, cast(coalesce(cons,0) float), wbcode commodities ccode in (2611,2513,2961) group wbcode||yr 

i want query above return sums every wbcode in given yr (usa1990), example; code above not summing up; retrieving same data as:

select wbcode||yr, cast(coalesce(cons,0) float), wbcode  commodities ccode in (2611) group wbcode||yr  select wbcode||yr, cast(coalesce(cons,0) float), wbcode  commodities ccode in (2513,2961) group wbcode||yr 

how can sum?

thank help.

why || ? group them separately

select wbcode, yr, sum(cast(coalesce(cons,0) float)), wbcode commodities ccode in (2611,2513,2961) group wbcode, yr 

or

select wbcode||yr, sum(cast(coalesce(cons,0) float)), wbcode commodities ccode in (2611,2513,2961) group wbcode, yr 

Comments

Popular posts from this blog

python - Why doesn't list have safe "get" method like dictionary? -

razor - Is this a bug in WebMatrix PageData? -

sql server - Stored procedure -