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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

[CLOSED] MAX returning two rows

597691Mar 17 2008 — edited Mar 31 2008
Hi all,

I need to write a query that return 1 row.
If 'part 1' returns a value, the query needs to return null. If 'part 1' returns multiple values for latest_date, I need to return the latest of the dates.

Currently, this is the query I have. However this query returns more than 1 row.

Anny pointers are appreciated. Thanks

select Max(transaction_table.latest_date)
,transaction_table.status
from
---part 1
(select
sysdate latest_date
,'hello' status
from dual

UNION

--part 2
select
NULL latest_date
,NULL status
from dual) transaction_table

group by transaction_table.status;


RESULT:
MAX(TRANSACTION_TABLE.LATEST_DATE) STATUS
------------------------- ------

17-MAR-08 hello

2 rows selected

Message was edited by:
user594688

THANK YOU for all the replies
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 15 2008
Added on Mar 17 2008
9 comments
2,040 views