Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@prototype-G9Gn5k • Jul 18, 2012
Considering you're using MySQL,
SELECT * FROM `emp`
Are you trying to query from php and wants to display the results on the webpage? -
@neeraj-iAaNcG • Jul 18, 2012
I am doing it on sqldeveloper. And I am not a noob that I dont know the query that you have given me. Please read my question again and then answer[Prototype]Considering you're using MySQL,
SELECT * FROM `emp`
Are you trying to query from php and wants to display the results on the webpage? -
@prashanth-p-at-cchi-rg0z63 • Jul 18, 2012
select empname sal sum(sal) from emp group by deptno;
select sal from emp e where sal <
(select max(sal) from emp ea where ea.deptno = e.deptno) order by sal;
I am not sure of the above. It has been more that two years, me writing a SQL Query. Hope it might help you in arriving at the solution. -
@anoop-kumar-GDGRCn • Jul 18, 2012
select e.emp_name, e.Emp_sal, (select sum(e1.emp_sal) from emp_tab e1 where e.dept_id=e1.Dept_id group by e.Dept_id) as Salary_Sum, (Select emp_sal from emp_tab e2 where rownum=2 and e2.dept_id=e.dept_it order by e2.emp_salary desc ) as Sec_High_salary from emp_tab e where e.emp_ID='XXXXX'
-
@prashanth-p-at-cchi-rg0z63 • Jul 18, 2012
I think this should work... Nice!ianoopselect e.emp_name, e.Emp_sal, (select sum(e1.emp_sal) from emp_tab e1 where e.dept_id=e1.Dept_id group by e.Dept_id) as Salary_Sum, (Select emp_sal from emp_tab e2 where rownum=2 and e2.dept_id=e.dept_it order by e2.emp_salary desc ) as Sec_High_salary from emp_tab e where e.emp_ID='XXXXX'