MySQL Count linhas devolvidas

select count(*) from (select * from foo) as x;
Powerful Penguin