|
-
Requirement:
We need to pick 1st row of each deptno from emp and insert into emp1 table. 1st mean actual 1st row of emp table.
What is an "actual 1st row"? The first row for that deptno ever entered into the table? The first row for a deptno that gets returned? Unless you explicitly order the results then you should not infer anything from what gets returned first.
That said, try this:
select a.deptno, a.ename, a.job, a.sal
from emp a
where rowid = (select min(rowid)
from emp e
where e.deptno = a.deptno)
--
Paul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|