IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to use COUNT to produce a list of counts


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cheetz007

New User


Joined: 10 Aug 2006
Posts: 23

PostPosted: Wed Aug 30, 2006 5:33 pm
Reply with quote

Hi,

I have a table with rows that have a transaction date. I want to list the number of rows and the transaction date for each transaction date, so my output would look something like:

Code:

Trans Date       Number of rows with that date
01/08/2006                     45
02/08/2006                     23
03/08/2006                    101
etc
.

I want to do this using SPUFI, therefore I was thinking that COUNT should be able to do this, but I'm not too sure how I would go about it - I think maybe I will need to use group by and having, maybe?

Any ideas?
Code:
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1209
Location: Bangalore,India

PostPosted: Wed Aug 30, 2006 5:46 pm
Reply with quote

Select count(*), trans_date
from table
Group by trans_date
Back to top
View user's profile Send private message
cheetz007

New User


Joined: 10 Aug 2006
Posts: 23

PostPosted: Wed Aug 30, 2006 5:50 pm
Reply with quote

Oh dear, that's embarrasingly simple!

Thanks, it works a treat.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts DB2 Query to get the count of Unique ... DB2 2
No new posts REXX to get all Dataset names from a ... CLIST & REXX 5
No new posts Denomination counts by using PARSE in... DFSORT/ICETOOL 8
No new posts PDS member list with stats JCL & VSAM 6
Search our Forums:


Back to Top