If you come across this error message:
Error : syntax error at or near "$1"
This is due to the ' ? ' operator. You will need to switch ' ? ' for ' ?? ' in your SQL, and then your query should run successfully. If you are still stuck, drop us a message on our support chat.