Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Counting Different Values in the same field
Message
From
06/08/2003 15:37:42
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Counting Different Values in the same field
Miscellaneous
Thread ID:
00817447
Message ID:
00817447
Views:
56
What is the best way to count the total number of occurences of values that reside in the same column. I want to get these counts as 1 row grouped by owner.
Final requirement - accomplish this in a stored procedure.

I could run 9 COUNTS(*)s to get the data but that seems wrong.

Table Stru
ID INT 4
INTVALUE INT 4
DATAOWNER VARCHAR(3)


Int values range of allowable values is 1,2,3,4...,11

I want to create a return rowset with the number of

1's in Col 1
2's in Col 2
3's in Col 3
etcs
Example
Number of 1's Number of 2's Number of 3's
21 42 84
Terry Rooks
Software Systems Architect
Microsoft Certified Solution Developer.Net

If at first you don't succeed, then skydiving definitely isn't for you.
Next
Reply
Map
View

Click here to load this message in the networking platform