SQL Query to retrieve data based on latest date
select GREATEST(TRUNC(MAX(NVL(need_by_date,promised_date))),TRUNC(MAX(NVL(promised_date,need_by_date)))) from po_line_locations_all
this query gives the need_by_date (or) promised_date (which ever is later)
but if need_by_date (or) promised_date is changed in Run time, then i want the latest date
How should i do this?
Re: SQL Query to retrieve data based on latest date
You are getting what you have asked for in the SQL query.
Again can you specify what do you mean by [B]changed in Run time[/B].
I need some extra info to help u on that.
Re: SQL Query to retrieve data based on latest date
between I don't know why you have used max function in your query. If I am not wrong your query will work even if you remove max function from your query.
Correct me if i am wrong