Results 1 to 14 of 14

Thread: [RESOLVED] Get the max value of two different data in two different tables

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member aNubies's Avatar
    Join Date
    Aug 2008
    Posts
    558

    Re: Get the max value of two different data in two different tables

    @jm - yes indeed sir.

  2. #2
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Re: Get the max value of two different data in two different tables

    I'm struggling with your English a bit as well (good effort, though ) so I'm not sure this is the answer you want but I think you're after this:-

    Code:
    Select ID, Max(Date), Name
    From 
      (Select ID, Date, Name From Table1
      Union
      Select ID, Date, Name From Table2)
    Group By ID, Name
    The inner query 'combines' the two tables as HoneyBee suggested. The outer takes that combined table and returns you the highest date for each ID and Name combination.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

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