Click here to Skip to main content
15,924,367 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
id | quantity | Bonus | price | total

01 | 25 | 10 | 123 | 4305

01 | 5 | 10 | 123 | 1845


i want IT AS

id | quantity | Bonus | price | total

01 | 30 | 10 | 123 | 6150
Posted
Updated 12-Oct-14 19:45pm
v2
Comments
[no name] 13-Oct-14 1:41am    
show your query what have you tried
navya chowdary 13-Oct-14 1:53am    
select a.id ,SUM(a.QTY) AS quantity,avg(a.BONUS) AS BONUS,avg(a.UNIT_COST) AS PRICE,SUM(a.total) as total OF FROM
(SELECT a.id a.QTY,a.BONUS,a.UNIT_COST FROM STOCKDETAILS a, STOCKDETAILS b WHERE a.id ='A00006' and b.id='A00006' and a.id=b.id and a.STOCK_JR='IN' AND b.STOCK_JR='OU' )STOCKDETAILS

C#
select id, sum(quantity). Bonus, Price, sum(total)
from table
group by id, Bonus, price



But it doesn't make sense to me!
 
Share this answer
 
Try this
select id,sum(quantity) as quantity,Bonus , price,sum(total)as total
from table group by id,Bonus , price

thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900