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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
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.

Reply via email to