Skip to content
Advertisement

get the values mit highets value sql

the following table is given (in Oracle);

I want to get for all kids the father. If the there are more than one father (POD003, POD004 and POD005), take the value with the highest value from LVL column.

Result must be like this;

Thank you for your help.

Regards Serdar

Advertisement

Answer

You group by kid and get the maximum level and join to the main table:

See the demo

or with NOT EXISTS:

See the demo

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement