Reputation:
i'm trying to get out a COUNT() from the result of this query:
SELECT COUNT
(SELECT *
FROM `products` AS P
INNER JOIN `aste` AS A ON P.id_asta = A.id_asta
INNER JOIN aste_i18n AS B ON A.id_asta = B.id_asta
WHERE id_fallimento = 284
AND B.lang = 'it_IT')
How can i do this?
Thanks
Marco
Upvotes: 0
Views: 44
Reputation: 72185
Use the result of your query as a derived table and perform a COUNT
operation on it:
SELECT COUNT(*)
FROM (SELECT P.id_asta
FROM `products` AS P
INNER JOIN `aste` AS A ON P.id_asta = A.id_asta
INNER JOIN aste_i18n AS B ON A.id_asta = B.id_asta
WHERE id_fallimento = 284 AND B.lang = 'it_IT') AS t
Upvotes: 1