Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Produce Mainframe Dash Board Reports ... sdcarlson53 All Other Mainframe Topics 2 Thu Jan 05, 2017 11:01 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us