For example, the table has columns MYINDEX and NAME.
MYINDEX | NAME
=================
1 | BOB
2 | BOB
3 | CHARLES
Ho do I find row with highest MYINDEX for specific NAME? E.g. I want to find ROW-2 for name "BOB".
For example, the table has columns MYINDEX and NAME.
MYINDEX | NAME
=================
1 | BOB
2 | BOB
3 | CHARLES
Ho do I find row with highest MYINDEX for specific NAME? E.g. I want to find ROW-2 for name "BOB".
If you wanted to see the highest index for name = 'Bob', use:
If you want to skip the inner join, you could do:
SELECT Max(MYINDEX) FROM table WHERE NAME = [insertNameHere]
EDIT: to get the whole row:
There are several ways to tackle this one. I'm assuming that there may be other columns that you want from the row, otherwise as others have said, simply name,
MAX(my_index) ... GROUP BY name
will work. Here are a couple of examples:Another possible solution:
For the whole row, do:
Use