PHP最受欢迎的查询最近100条记录

I am using this query:

SELECT * from likes GROUP BY url ORDER BY count(*) DESC LIMIT 6

to fetch most liked record from my table 'likes'. It is working perfect for fetching most liked content of all time.

But now to I want to select the 6 most liked record from the last 100 records.

What will be the query for it ?

SELECT * FROM (select * from likes order by date desc limit 100) xx
Group by URL order by count(*) limit 6

Obtain the primary keys of the last 100 entries and narrow your query to it. Probably extremely easy if you have auto-increment keys.

SELECT * from likes
  GROUP BY url 
  ORDER BY count(*) DESC 
  WHERE ID > MAX(ID)-100
  LIMIT 6