- Forum
- Databases
- Oracle SQL Query to retrieve data based on latest date
-
Junior Member
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 changed in Run time.
I need some extra info to help u on that.
-
Expert Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules