I have declared a variable in a heidisql tab like this
DECLARE total_count INT DEFAULT 0;
SET total_count = 10;
select total_count;
but i get this error
/* SQL Error (1064): 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 'DECLARE total_count INT DEFAULT 0' at line 1 / / Affected rows: 0 Found rows: 0 Warnings: 0 Duration for 0 of 3 queries: 0.000 sec. */
Should i be declaring ,setting and using the variable like i have done or must i wrap everything inside a stored procedure or a function?.
@
sqlfiddle.com/#!2/6b97db/16 – Ruffin