SQL Server Aggregate functions -


i have table has 3 columns: customers, billingdate, consumption

city - parks/6th ave bmx park   2013-04-29 00:00:00.000 0 city - parks/6th ave bmx park   2013-04-29 00:00:00.000 30 city - parks/6th ave bmx park   2013-05-30 00:00:00.000 0 city - parks/6th ave bmx park   2013-05-30 00:00:00.000 19500 city - parks/6th ave bmx park   2013-06-28 00:00:00.000 0 city - parks/6th ave bmx park   2013-06-28 00:00:00.000 42100 city - fire station #3  2012-11-27 00:00:00.000 0 city - fire station #3  2012-11-27 00:00:00.000 8900 city - fire station #3  2012-12-27 00:00:00.000 0 city - fire station #3  2012-12-27 00:00:00.000 7900 city - fire station #3  2013-01-28 00:00:00.000 0 city - fire station #3  2013-01-28 00:00:00.000 3090 city - fire station #3  2013-01-28 00:00:00.000 7210 city - fire station #3  2013-02-28 00:00:00.000 0 city - fire station #3  2013-02-28 00:00:00.000 10100 city - fire station #3  2013-03-29 00:00:00.000 0 city - fire station #3  2013-03-29 00:00:00.000 6700 city - fire station #3  2013-04-29 00:00:00.000 0 city - fire station #3  2013-04-29 00:00:00.000 9100 city - fire station #3  2013-05-30 00:00:00.000 0 city - fire station #3  2013-05-30 00:00:00.000 11100 city - fire station #3  2013-06-28 00:00:00.000 0 city - fire station #3  2013-06-28 00:00:00.000 12700 city - fire station #3  2012-07-27 00:00:00.000 0 city - fire station #3  2012-08-27 00:00:00.000 0 city - fire station #3  2012-08-27 00:00:00.000 1630 city - fire station #3  2012-09-28 00:00:00.000 0 

since have same billingdate same customer, want sum consuption based on matching billingdate. should give me following:

city - parks/6th ave bmx park   2013-04-29 00:00:00.000 30 city - parks/6th ave bmx park   2013-05-30 00:00:00.000 19500 city - parks/6th ave bmx park   2013-06-28 00:00:00.000 42100 city - fire station #3  2012-11-27 00:00:00.000 8900 

and on....

i posted similar question did not looking for. thank sql experts.

if haven't missed something

select customers, billingdate, sum(consumption) table1 group customers, billingdate 

Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -