Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ID | Fruit | cost | color
1  | Apple | $5   | green
2  | Apple | $6   | red



How do I get only one row Apple = $11
Posted
Updated 16-Sep-14 23:40pm
v2

Hi,

Check this...

SQL
Select sum(cost) from yourTable group by fruit

or

Select '$' + CONVERT(VARCHAR,sum(CONVERT(DECIMAL(10,2),replace(cost,'$','')))) as COST from yourTable group by fruit


Hope this will help you.

Cheers
 
Share this answer
 
v3
SQL
select SUM(CAST(REPLACE(cost,'$','')as float)) from Tablename group by Fruit
 
Share this answer
 
v2
Use..


C#
delete from tbl_name where primary_key(unique)="value"

like

C#
delete from tbl_name where Id=1



please don't post any thing like that, if you have any problen in coding or
related to this type, then post here with as simple as possible description.
users can solve it if you post the coprrect question with enough explanation.
 
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