Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group By problem

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
I have a table which columns like "category", "Amount" and some other half a dozen columns.
i want an SQL query which will select ALL the columns of the table ..grouped by "category" and giving Sum of "Amount" for that category.

Desired op shud be like this :

"Category" "Amount" "SumAmountsbycategory" col3
A 100 150

A 50 150

B 20 60

B 40 60
Can any one help me ?

 

Select
Category, Amount,
SumAmountsByCategory=
(Select Sum(Amount) From Table
Where Category = a.Category),
col3, col4, ....
From Table a Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top