Indeed, the problem is finding the correct escape characters.
When I was using URLs like this, I just copy pasted the select statement in a browser (like firefox) and let him resolve the escaping.
E.g. query: select * from a where b <= 1000
Paste this as:
http://a.b.c/a?select * from a where b <= 1000
Returns as:
http://a.b.c/a?select%20*%20from%20a%20where%20b%20%3C=%201000Rather stupid, but it works ;)