DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: max date

  1. #1
    Join Date
    Mar 2004
    Posts
    52

    max date

    What's wrong with this query .
    I am looking for the latest date

    select max(to_char(created_date,'dd/mm/yy hh24:mi:ss') from pay_info;

    This gives some old data and i know i have latest data

    when i query like this it gives me an error

    select to_char(max(created_date,'dd/mm/yy hh24:mi:ss') from pay_info;


    any idea folks?

    thnaks
    Ramana

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092

    Re: max date

    Originally posted by RamanaSQL
    What's wrong with this query .
    I am looking for the latest date

    select max(to_char(created_date,'dd/mm/yy hh24:mi:ss') from pay_info;

    This gives some old data and i know i have latest data

    of course, you're getting the max() of a string


    when i query like this it gives me an error

    select to_char(max(created_date,'dd/mm/yy hh24:mi:ss') from pay_info;
    What's the error? What is the data type of created_date?
    Jeff Hunter

  3. #3
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    check this out...

    select to_char(max(created_date),'dd/mm/yy hh24:mi:ss') from pay_info;

    Srini

  4. #4
    Join Date
    Mar 2004
    Posts
    52
    It worked ..thanks Srinivas_Sharma
    and thank you marist89

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width