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

Count & Sum 2

Status
Not open for further replies.

jmandiaz

IS-IT--Management
Apr 22, 2001
110
US
Hey guys i have a table with the following information.

000-secure 1000
000-secure 1000
000-secure 1000
000-secure 1000
000-secure
000-secure
001-unsecure
001-unsecure
001-unsecure
001-unsecure
002-insecure
002-insecure

I want to be able to display the data as

code NBR-OF Total
000-secure 6 6000
001-unsecure 4 -


How can i attain this? Thanks in advance

-Jaime
 
Something like this ?
SELECT code, Count(*) As [NBR-OF], Sum([value field]) As Total
FROM

GROUP BY code;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Select
code,
Count(*) as nbr_of,
Sum(qty) as total
From yourtable
Group by code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top