0

Hi this seems like very easy task but I could not find answer for it. I would like to get only one row from table where some specific column has maximum value.

So, for example if I have this table:

╔═══════╦═════╦═══════╗
║ Name  ║ Age ║ Color ║
╠═══════╬═════╬═══════╣
║ Jakub ║  55 ║ Red   ║
║ Nick  ║  24 ║ Black ║
║ Alice ║  38 ║ Blue  ║
╚═══════╩═════╩═══════╝

I would like to know how can I get the row "Jakub 55 Red" based on that the age is maximal.

I though it will be something like select * from people where age is max but it doesn't work. I am using TimesTen.

Jakub Znamenáček
  • 766
  • 1
  • 4
  • 18
  • 1
    `Select top 1 * from table order by Age desc` - or `limit 1`, depending on specific syntax needed – Stu Jan 04 '22 at 12:46

2 Answers2

0
SELECT S.NAME,S.AGE,S.COLOR
FROM YOUR_TABLE AS S
WHERE S.AGE=(SELECT MAX(AGE) FROM YOUR_TABLE) 

Could you please try this one

Sergey
  • 4,719
  • 1
  • 6
  • 11
0

Based on Stu's answer the solution I was looking for is select first 1 * from people order by age desc, thank you all for help!

Jakub Znamenáček
  • 766
  • 1
  • 4
  • 18