• charipg (1/28/2010)


    Please correct the below query..........

    select max(myDate) from

    ( select field_1 myDate from myTable

    union all

    select field_2 myDate from myTable

    union all

    select field_3 myDate from myTable)

    If you add an alias at the end of your query to give your UNION statement a "pseudo table name", the query will return a result.

    Note: Since you didn't mention whether you get an error message (or even what that error would have been) I'm just guessing that this is what you're looking for...

    select max(myDate) from

    ( select field_1 myDate from myTable

    union all

    select field_2 myDate from myTable

    union all

    select field_3 myDate from myTable) uniontable



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]