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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make sql command????

Status
Not open for further replies.

bon011

Programmer
Jun 2, 2002
155
CZ
Hi all,

This is example of table

id type count
1 A 2
1 A 3
1 B 5
2 A 1
2 B 2
3 C 3
3 C 4

How to make SQL select command that will make sum of filed "count". But it must sum rows that have same id and type.

The result should look like this:

id type count
1 A 5
1 B 5
2 A 1
2 B 2
3 C 7

How to do that with sql command?
 
Does anyone has an example of a select instruction and how to open the database. I want to create a recordset and I don't know how.
Thanks in advance.
 
Bon011,

Why not pass on what your solution was. Then we can all share in it.

Regards

Griff
Keep [Smile]ing
 
select id, type, sum(count) from mytable group by id, type

That is all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top