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

Problem in COUNT(*) to count the no of rows present


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

New User


Joined: 06 May 2007
Posts: 16
Location: pune

PostPosted: Thu Feb 07, 2008 1:12 pm
Reply with quote

Hi All,

I have i am using the following query in order to count the no of rows present in the table

SELECT COUNT(*) FROM A.EMP

Its returning me a value X.

But if i use the folloing query

SELECT COUNT(*) FROM A.EMP WHERE A_CO = '01'

then this should give me a value either X or less than X.

But the second query is giving me the count which is four times that the first one.

Note: My table contains HUGE no of records.

Please let me ans fot this
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Feb 07, 2008 1:51 pm
Reply with quote

small question- are you running both the queries against same subsystem?
Sometimes I tend to do mistake of running SPUFI against table one region and program plan runs the query against table in some different region with same name.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Feb 07, 2008 6:45 pm
Reply with quote

Try COUNT_BIG(*) instead of COUNT(*)!
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Feb 09, 2008 12:54 am
Reply with quote

Did you get a resolution for this?
Back to top
View user's profile Send private message
TMOORE

New User


Joined: 08 Feb 2008
Posts: 4
Location: Macon Georgia

PostPosted: Sat Feb 09, 2008 2:27 am
Reply with quote

Although rare, I have had a corrupted index cause this condition once before. When the predicate is indexable using the corrupted index, you get an incorrect answer.
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 Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
Search our Forums:

Back to Top