Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to use COUNT to produce a list of counts

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to use COUNT to produce a list of counts
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: 1187
Location: Bangalore,India

PostPosted: Wed Aug 30, 2006 5:46 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts CICS Transaction attach count of supp... lind sh CICS 1 Wed Jun 21, 2017 1:33 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us