How can I find out the min/max value form multiple tables?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Narendraaaaaa
    New Member
    • Sep 2010
    • 1

    How can I find out the min/max value form multiple tables?

    I have three tables with same column as Salary. I want to find out the min salary from the three tables. Pleas help me in this

    Regards,
    Narendra.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    kindly post the query that you are working on currently to get help from our experts.

    Comment

    • magicwand
      New Member
      • Mar 2010
      • 41

      #3
      Code:
      select min(dat)
      from
         ( select min(<date_col_in_tbl_1>) dat from <tbl_1>
           union
           select min(<date_col_in_tbl_2>) dat from <tbl_2>
           union
           select min(<date_col_in_tbl_3>) dat from <tbl_3>
         )
      ;

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        something like this:

        [code=oracle]
        select min(salary) from
        (select salary from tab1
        union
        select salary from tab2
        union
        select salary from tab3)
        [/code]

        Comment

        Working...