Can I set variable for sql statement in script report?

Hi Developers

When i execute sql statement “SET @VARIABLE = 0;” in script report.

I get error

ProgrammingError: (1064, “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘select\n\t\t\torder_year,\n\t\t\tproject_type,\n\t\t\tproject_number,\n\t\t\tproject_name,\n\t\t\tit’ at line 3”)

After that, I removed it and execute passed.
Can I set variable in sql statment ?


Kind Regards,
Worawat Pansawat

You may find this link helpful

1 Like

Thank you.

Link is broken Please Update Link or answer No information found about the error ! Please Reply ASAP

Hey I found this link, probably it would help you

Eeven better here is a cached version of the link above :

thank you so much for the link . it helped a lot
i figured out it is a python mysql issue not a frappe one.
run them as two queries first to set variable and the next one where u used it. it may help to other people

1 Like