filter - SQL Query to Add Values from Column X for Every Entry That Has Y -


i need write query going calculate sum of 1 column depending on values of another. need sum of drug administered each patient in 1 of db's tables. table has account number column (x), drug id column (y) , amount administered column (z). thing there can multiple rows each account number need pull total amount of drug administered each patient account number. in essence need query return sum of z for every x clause @ end using column y. hope explaining because thinking confuses me! appreciated. guys!

this simple group query, i'm not sure what's confusing you.

select x, sum(z) total_z table y = 123 group x 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -