|
|
|
Re: How to find total no of employee and no of employee in given years [message #605069 is a reply to message #605053] |
Tue, 07 January 2014 04:36 |
|
Michel Cadot
Messages: 68641 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
SQL> select count(*) total,
2 count(decode(extract(year from hiredate), 1981, empno)) "1981",
3 count(decode(extract(year from hiredate), 1982, empno)) "1982",
4 count(decode(extract(year from hiredate), 1983, empno)) "1983",
5 count(decode(extract(year from hiredate), 1984, empno)) "1984",
6 count(decode(extract(year from hiredate), 1986, empno)) "1986"
7 from emp;
TOTAL 1981 1982 1983 1984 1986
---------- ---------- ---------- ---------- ---------- ----------
14 10 1 0 0 0
|
|
|
|
|
|
|
Re: How to find total no of employee and no of employee in given years [message #605519 is a reply to message #605518] |
Fri, 10 January 2014 04:14 |
cookiemonster
Messages: 13920 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
1) I seriously doubt you'd notice a performance difference.
2) Are you really saying you can't convert those decodes to case statements? Why not? Do you not understand the decode syntax or case syntax? Both are documented and that decode is as simple as it gets. So give it a try and if you get stuck post what you tried and we'll point out where you're going wrong.
|
|
|