Za předpokladu ID
je AUTO_INCREMENT
sloupec,
SELECT a.user_ID, a.action
FROM tableName a
INNER JOIN
(
SELECT DISTINCT user_ID
FROM tableName
ORDER BY ID DESC
LIMIT 3
) b ON user_ID = b.user_ID