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 count number of rows in table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 93
Location: Delhi

PostPosted: Fri May 29, 2009 9:42 am    Post subject: How to count number of rows in table
Reply with quote

I have table

COL_NBR PRD_DT
=======================
abc 0001-01-01
def 0001-01-01
abc 2001-01-01
ghi 0001-01-01


I want to count number of rows present in this table where
count of COL_NBR is 1 only.

In output I need

COL_NBR PRD_DT
=======================
def 0001-01-01
ghi 0001-01-01

Please tell me how can I do this
Back to top
View user's profile Send private message

ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Fri May 29, 2009 10:35 am    Post subject:
Reply with quote

you can try the following query.

Code:

SELECT COL_NBR,PRD_DT,COUNT(*) AS COUNT1   
FROM table
GROUP BY COL_NBR                     
HAVING COUNT(*) = 1;
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 Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm

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