469,328 Members | 1,327 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

Count() and count(*) in DB2

How to find out the number of distinct rows in a table with no primary key
or in a join?
May 31 '07 #1
3 15880
frozenmist
179 Expert 100+
Hi Vijaya,
Do

Select count(*) from (select distinct * from <table name>)

Cheers
May 31 '07 #2
chandu031
78 Expert
How to find out the number of distinct rows in a table with no primary key
or in a join?
Hi Vijaya,

Try out this :

Expand|Select|Wrap|Line Numbers
  1. select count(1) from (select distinct * from <table>)
  2.  
Cheers!
May 31 '07 #3
Hevan
17
Hi,

If you want a count of particular column try this

select count(distinct(colname)) from table
Jun 1 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

22 posts views Thread by Ling Lee | last post: by
6 posts views Thread by Geetha | last post: by
5 posts views Thread by Eric Johannsen | last post: by
23 posts views Thread by Gary Wessle | last post: by
22 posts views Thread by MP | last post: by
3 posts views Thread by Auddog | last post: by
7 posts views Thread by Chris | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.