CA Datacom SQL query to count total number of rows for each different column value
book
Article ID: 190904
calendar_today
Updated On: 05-14-2020
Products
Datacom
DATACOM - AD
Datacom/DB
INFOCAI MAINTENANCE
Issue/Introduction
How to code a CA Datacom SQL query to get a count of the total number of rows for each different column value?
Environment
Release : 15.1
Component : CA DATACOM SQL
Resolution
Code the query as follows:
SELECT column_name, COUNT(*)
FROM table
GROUP BY column_name;
Here is an example using the demo Human Resources database:
SELECT STATE_ADDRESS, COUNT(*)
FROM SYSUSR.PERSONNEL
GROUP BY STATE_ADDRESS;
STATE_ADDRESS COUNT(*)
CHAR(2) N.N. INT N.N.
_____________ ___________
CA 46
GA 21
IL 27
MA 28
NY 28
TX 50
___ 6 rows returned ___
Feedback
Was this article helpful?
thumb_up
Yes
thumb_down
No