You have to ensure the quotes end up in the gsql shell.
ssh -p29418 <host> gerrit gsql -c '"select * from accounts;"'
(first single quote ' , then double quote " )
gerrit gsql -c "\"select * from ACCOUNT_GROUP_NAMES where name='Reviewer_simulator'\""
http://repo-discuss.narkive.com/j6WKLysJ/how-can-i-use-gerrit-gsql-c-option