ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  SQL Subqueries
Subject:   help
Date:   2005-09-13 21:47:18
From:   sumeet_
i want to select all columns from a table for the minimum of two columns. the table has few records with both minimums coming together.so i want these rows.


i tried e.g.


select distinct * from emp where sal=(select min( e.sal) from emp e where e.deptno <= (select min(t.deptno) from emp t));



i also tried


select * from emp where sal=(select min( e.sal) from emp e where 1=(select count ( di
stinct empno) from emp t where e.deptno <=t.deptno group by e.sal));




1 to 1 of 1
  1. help
    2005-12-22 13:12:18  dazednconfused [View]

    • help
      2007-07-05 15:25:49  Poon [View]

1 to 1 of 1