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!

Returning first non null value in single expression

spalato76Sep 15 2011 — edited Sep 15 2011
Hi,

I have the following table structure with data:

ID Order Date Order #
1 07-Aug-11 1
1 2
1 3
1 4
2 15-Aug-11 1
2 2
2 3
2 4
2 5
2 6

How do I select for each distinct ID the first non null value so I would get the following returned:

ID Order Date
1 07-Aug-11
2 15-Aug-11

I know the coalesce function returns the first non null value but I have to specify at least two expressions while in my example above I only need to use one column/expression.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 13 2011
Added on Sep 15 2011
3 comments
226 views