Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2010
    Posts
    11

    Talking Unanswered: Distict order by

    select distinct ENTRY_DATE from CIRC.SUBS_TAG
    ORDER BY to_date( ENTRY_DATE, 'mm/dd/yyyy' )ASC

    I get "invalid sql statement error". I want the distinct entries in order. Thank you.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    If ENTRY_DATE is already a DATE column there is no sense in converting it to a date. Simply remove the unneccessary (and wrong) to_date call

    So the correct SQL is

    Code:
    select distinct ENTRY_DATE 
    from CIRC.SUBS_TAG
    ORDER BY ENTRY_DATE ASC
    You should really read the manual regarding what to_date() is doing.

    I think you have a big misunderstanding about the concepts (judging by your two DATE related questions)

    And please use [code] tags in the future to make your SQL readable!

Posting Permissions

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