hello all

i kindly help me out

i have a table in sql server with transaction id and amount i want to add the amount values of those rows where id is same
for example
i have 4 times 2 in transaction id table now i want to add all the entries in amount column corresponding to the trans id 2.

is there any way

i have c# on front end and sql server 2000 on back end

The general SQL formual is:

SELECT SUM(expression )
FROM tables
WHERE predicates
ORDER BY predicates;

So, in your case, you might want:

SELECT transaction_id, SUM(amount)
FROM mytable
ORDER BY tranaction_id

You may or may not want the transaction_id as a SELECT column. You can just take it out if you don't.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.