I need a query to select the last rows of some column scope.
Example, the whole table:
----------------------
| ID | NAME | FOO_ID |
|--------------------|
| 1 | jQue | 2 |
| 2 | Prot | 2 |
| 3 | Node | 2 |
| 4 | Moo | 1 |
| 5 | Scri | 1 |
----------------------
Rows returned by query, that returns all the “last row” in FOO_ID column scope:
----------------------
| ID | NAME | FOO_ID |
|--------------------|
| 3 | Node | 2 |
| 5 | Scri | 1 |
----------------------
Can someone help me in how to code this query?
I’d use whichever of these you find most clear:
or
or
or
(My own preference is the version with
IN, but you may feel differently.)