Add an external count field to a query

How can I retrieve the full SQL generated?


The error exactly is 
'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''SELECT COUNT(*) FROM TABLEA WHERE TABLEA.CUSTOMERID = A.ID  As '' at line 1'