sql server - Grouping and sum in sql -
i trying extract following columns sql table called vouchers:
- date,
- voucherid,
- valueissued,
- valueredeemed,
- valueexpired
that bit straight forwards , returns below data:
however show them
- by day,
- by voucherid
and sum values each individual voucherid produce view similar below:
can point me in correct direction in regards sql code this?
i using ssms 2014
it's pretty straight forward
select posdate, voucherid, sum(valueissued), sum(valueredeemed) vouchers group posdate, voucherid
note column dateexpired isn't correct in context. should either grouped or removed entirely (as did)
Comments
Post a Comment