これをチェックしてください
SET @counter = 0;
SET @category = '';
SELECT
*
FROM
(
SELECT
@counter := IF(posts.category = @category, @counter + 1, 0) AS counter,
@category := posts.category,
posts.*
FROM
(
SELECT
*
FROM test
ORDER BY category, date DESC
) posts
) posts
HAVING counter < 2