Codice PHP:
SELECT count(tabella1.*) as totale1count(tabella2.*) as totale2 FROM tabella1tabella2 WHERE tabella1.id AND tabella1.id2 tabella2.id2;

non l'ho testato..prova