Consider below table:
EmpId EmpType ExpUniId
1 A 234
1 B 453
2 A 454
I want to write a sql query such that I get following data
EmpId EmpType ExpUniId Count
1 A 234 2
1 B 453 2
2 A 454 1
Count implies number of rows corresponding to each Emp Id
I am using Oracle Sql.
Thanks
You are looking for the analytic version of count()
:
select t.*,
count(*) over (partition by EmpId) as Count
from table t;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.