I'm writing a small bash script to get a random sample of a database table, connecting through ssh.
ssh $SERVER 'mysql -e "SELECT * FROM ${TABLE} WHERE RAND() < ${PROBABILITY} LIMIT ${LIMIT}" -uroot -p ${DATABASE} > temp_dump_file.sql'
I can't get the arguments to be interpreted. The error is:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE RAND() < LIMIT' at line 1
Thanks in advance :)