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: 1208
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
Search our Forums:

Back to Top