sql server - SQL Count/sum multiple columns -


i want use count/ sum multiple fields in single query sample data , desired result listed below:

memid  claimnum  itemid paidamt  123    1234      4      5 123    2309      4      5  123    1209      4      5  123    1209      8      2.2 123    1210      8      2.2 

desired result

memid  count(claimnum) count(itemid) sum(paidamt)  123    3               3             15  123    2               2             4.4    

it looks want group both memid , itemid:

select memid, count(claimnum), count(itemid), sum(paidamt)    the_table  group memid, itemid 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -