Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Count Or Count (*) Over ( Partition by col name))

696393May 25 2009 — edited Jul 13 2012
SQL> SELECT * FROM (SELECT employee_id, COUNT( employee_id) OVER ( PARTITION BY employee_id) cnt
FROM all_employees@ougt1prd
) Where Cnt> 1


out put is total rowcount 448


SQL > SELECT employee_id, COUNT(employee_id) cnt
FROM all_employees@ougt1prd
having COUNT(employee_id)> 1
group by employee_id;

out put is total rowcount 219



im trying to count the employee_id group by employee_id , i used above query's but each gives me diffrent answer's ?

any idea why the out put chages , the functionality are same for both...



thanks,

Raj
This post has been answered by MaximDemenko on May 25 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2012
Added on May 25 2009
8 comments
89,919 views