I want to get out of database 5 recently added articles by user and also count how many did he added in general. This was my query:
SELECT *
FROM articles
WHERE user = :user
ORDER BY publish_date DESC
LIMIT 5
What I simply changed to:
SELECT COUNT(*)
FROM (
SELECT *
FROM articles
WHERE user = :user
ORDER BY publish_date DESC
LIMIT 5)
But this gives me an empty array. I don't want to split it into 2 queries, what can be the result?