I was looking for a single function that does the required.. Your union query works fine for me. Thanks a lot, Rami.
-Chandra On Monday, June 30, 2014 12:29:41 PM UTC+1, Rami Ojares wrote: > > > SELECT NAME, MAX(MAXVAL), TYPE > FROM ( > SELECT NAME, VALUE1 MAXVAL, TYPE > UNION ALL > SELECT NAME, VALUE2 MAXVAL, TYPE > UNION ALL > SELECT NAME, VALUE3 MAXVAL, TYPE > ) > GROUP BY NAME, TYPE > > - Rami > > On 30.6.2014 13:21, Chandra DhulipalaV wrote: > > How do you return 1 value per row of the max of several columns:- > > TableName [Name, Value1, Value2, Value3, Type] > > I need to return something like this: [Name, Most_Recent_Value, Type] > > Can you please let me know how to write the Query? > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
