Results 1 to 3 of 3

Thread: SQL Query to retrieve data based on latest date

  1. #1
    Junior Member
    Join Date
    Jul 2007
    Answers
    1

    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?


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    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.


  3. #3
    Expert Member
    Join Date
    Jun 2006
    Answers
    410

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact