Is there any way for me to access mySQL by querying using info from a cell?

like

select count(*) from table1 where id = $A1;

or something to that effect?
Thanks.