2

How to delete rows which are not recent in a 1-to-many table.

create table foo (id, ...)
create table bar (id, foo_id, created_at, ...)

I would like to delete all bars for each foo and keep only 10 bars (max) for each foo. How do I delete this in a dynamic fashion

Rpj
  • 5,348
  • 16
  • 62
  • 122
  • possible duplicate of [Get top n records for each group of grouped results](http://stackoverflow.com/questions/12113699/get-top-n-records-for-each-group-of-grouped-results) – RandomSeed Jan 19 '15 at 11:14

0 Answers0