[CLOSED] MAX returning two rows
597691Mar 17 2008 — edited Mar 31 2008Hi 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