-3

In sql. How can I select the last sequence of each record. For example my table is

1 cat
2 cat
3 cat
1 dog
2 dog

I want the result to be

3 cat
2 dog

I tried Max and order by. But it looks at entire record-set. Cant do it per animal

Select *
from table
order by animal

This gives all the ones first

Thom A
  • 88,727
  • 11
  • 45
  • 75
Martin
  • 1
  • 1

0 Answers0