getting mysql error when running the query alognwith ssh I am getting " You have an error in your SQL syntax; check the manual that corresponds to your MySQL server" error when running alongwith ssh command :

ssh user@localhost echo "delete from partner_company_association where colId = \"default.col \";" | /usr/bin/mysql -h localhost dbname


But the same works fine without doing ssh and running directly in the box:

 echo "delete from partner_company_association where colId = \"default.col \";" | /usr/bin/mysql -h localhost dbname


Kindly help me in figuring out the mistake here. 
thanks in advance.
I may be wrong here - but isn't the echo command running on the server you're reaching via ssh - and the /usr/bin/mysql running on your local machine?

Whereas, both commands are running on the remote machine when issued on the remote machine, without the ssh?

What if you moved the ssh call to after the pipe, on the /usr/bin/mysql command?

NOTE: It's been a while since I used Unix/Linux, but a quick Google check on ssh seems to indicate this is how it works....