Page 1 of 1

Sql queary

Posted: Mon Sep 17, 2007 12:33 am
by myharshdesigner
i want to use Group by
but i also wan to display all the rows which is presented in the database.
And at the end of a group i want to display Some of all The rows in a group.

like i have 10 rows in a database and there is a three group

in 1st group there is 5 rows.

in 2nd group there is 2 rows.

and

in 3rd group there is 3 rows.

so i just want to display the sum of all amount in a group.

so pl tell me what query i suppose to use for getting what i want .

waiting for some help
with example

thanks

Posted: Mon Sep 17, 2007 3:52 am
by CoderGoblin
Do you mean something like...

Code: Select all

SELECT mygroup,count(mygroup) FROM tablename GROUP BY mygroup;
(where mygroup is the column you are grouping on).