chandra916 Posted May 15, 2014 Report Posted May 15, 2014 How to get the highest salary and the employee names from dept no 10 and 20? evarina query ela raayalo cheppandi ayya
electionszindabad Posted May 15, 2014 Report Posted May 15, 2014 use MAX of salary , employee name group by department where dep no in 10,20 syntax rasukoo i dont know oracle syntax
chandra916 Posted May 15, 2014 Author Report Posted May 15, 2014 use MAX of salary , employee name group by department where dep no in 10,20 syntax rasukoo i dont know oracle syntax where clause thrawatha Group by vasthuna leka grouo by vachhina tharwatha where clause vasthunda??
electionszindabad Posted May 15, 2014 Report Posted May 15, 2014 group by end lo.. group by deparment pettinappudu select lo col list lo kuda include cheyyali nenu concept explain chesa oracle syntax naku clear ga teledu.. google chudu
chandra916 Posted May 15, 2014 Author Report Posted May 15, 2014 group by end lo.. group by deparment pettinappudu select lo col list lo kuda include cheyyali nenu concept explain chesa oracle syntax naku clear ga teledu.. google chudu ok thanks
mettastar Posted May 15, 2014 Report Posted May 15, 2014 select dept_no,emp_name, salary from ( select dept_no,emp_name, salary, rank() over (partition by deptno order by salary desc) as rank from Employee ) X where x.dept_no in (10,20) and rank=1
mettastar Posted May 15, 2014 Report Posted May 15, 2014 ok thanks group by cheyalevu.. look at the sql i provided
chandra916 Posted May 15, 2014 Author Report Posted May 15, 2014 select dept_no,emp_name, salary from ( select dept_no,emp_name, salary, rank() over (partition by deptno order by salary desc) from Employee ) X where x.dept_no in (10,20) ma odu inka partition varaku raaledhu and rank kuda inka cheppaledhu
chandra916 Posted May 15, 2014 Author Report Posted May 15, 2014 group by cheyalevu.. look at the sql i provided avunu group by chesthunte quesry error vasthundi....but why group by enduku work avadu any explaination??
mettastar Posted May 15, 2014 Report Posted May 15, 2014 ma odu inka partition varaku raaledhu and rank kuda inka cheppaledhu ok then see below select x.dept_no,x.emp_name,y.Max_Sal from Employee X, ( select dept_no,max(salary) Max_Sal from Employee group by dept_no ) Y where x.dept_no=y.dept_no and x.salary=y.max_sal and x.dept_no in (10,20)
mettastar Posted May 15, 2014 Report Posted May 15, 2014 avunu group by chesthunte quesry error vasthundi....but why group by enduku work avadu any explaination?? Dept lo max salary kavalante Only Dept medane group by cheyali and select lo kuda only Dept num and Max(salary) ne undali.. kaani ne requirement lo EMployee name kuda kavali kada.. paina query raasa chudu alaa cheyachu
chandra916 Posted May 15, 2014 Author Report Posted May 15, 2014 ok then see below select x.dept_no,x.emp_name,y.Max_Sal from Employee X, ( select dept_no,max(salary) Max_Sal from Employee group by dept_no ) Y where x.dept_no=y.dept_no and x.salary=y.max_sal and x.dept_no in (10,20) thanks bhayya.....from clause tharawatha brackets lo rasaav kadha aa quesry ni emantaru??ma odu subquery where clause tharawatha raasetodu
mettastar Posted May 15, 2014 Report Posted May 15, 2014 thanks bhayya.....from clause tharawatha brackets lo rasaav kadha aa quesry ni emantaru??ma odu subquery where clause tharawatha raasetodu Sub Query ne antaru anukunta.. ela aina raayachu
chandra916 Posted May 15, 2014 Author Report Posted May 15, 2014 Sub Query ne antaru anukunta.. ela aina raayachu ok ok......
chandra916 Posted May 15, 2014 Author Report Posted May 15, 2014 Dept lo max salary kavalante Only Dept medane group by cheyali and select lo kuda only Dept num and Max(salary) ne undali.. kaani ne requirement lo EMployee name kuda kavali kada.. paina query raasa chudu alaa cheyachu thanks bhayya for the explaination
Recommended Posts