Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to select the min row per group

tharpaNov 29 2011 — edited Nov 29 2011
I want to select the row from each group where the value in one column is the lowest for that group.

The following does not work:
select contactID, PhoneID, Phone
from PhoneNumber
where PhoneID= (select min(PhoneID) from PhoneNumber as p where p.contactID = PhoneNumber.contactID)
I have tried this many ways. The above way gives me, "missing right parenthesis", even though there is no missing right parenthesis.
This post has been answered by 584412 on Nov 29 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 27 2011
Added on Nov 29 2011
3 comments
2,066 views