you can do this with a second query
your first query removed “duplicates” based on same name and price, keeping oldest date
it involved a subquery which did a GROUP BY on two columns
now you want to remove “duplicates” based on same name and price and date, keeping lowest/highest id value
so use a subquery which does a GROUP BY on three columns