get the maximum value from a query with a join

  • friends i need to get the maximum value from a query which is composed with a join

     

    example

    select    max (   select data from tableA

                        union all

                        select data from tableB )

     

    if i will use the query like this it casts error

    is possible to do that anyway?

    Thanks for your helping

  • You may try the following:

    select max(data)

    from

    (

    select data from tableA

    union all

    select data from tableB

    )t

  • Excellent thank you

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply