5 pts.
 Need SQL query
Hi, I have a emp table in which I have 7 columns and hiredate is one of the columns. I need to query for the hiredate which has maximum number of employees joined the company on a particular date?

Software/Hardware used:
ASKED: October 30, 2008  8:36 AM
UPDATED: November 21, 2008  6:40 AM

Answer Wiki:
I woud sujest this .. This gives you the result wanted in less time. query optimized and tested. with a.temp (j_date,cnt) as ( select join_date,count(*) as c1 from a.emp_table group by join_date ) select j_date from a.temp where cnt= (select max(cnt) from a.temp) concepts used ... GROUP BY , Temporary table 1. The query <b>select join_date,count(*) as c1 from a.emp_table group by join_date </b> gives u .. join date , Count of employees joined for the date 2. Thse records are taken as a temp table. <b> select j_date from a.temp where cnt= (select max(cnt) from a.temp)</b> -> give the date with max count of joining.. Simple and the optimal query which can give u the best result ;-) check if any more query issues ... http://c1deal.blog.co.in/ Regards, Krishna ,DBA
Last Wiki Answer Submitted:  November 21, 2008  6:40 am  by  Randym   1,740 pts.
All Answer Wiki Contributors:  Randym   1,740 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _