maybe it's already known problem, or maybe it's a feature:
F12 (“format current query”) not only format the current query; it also removes all blank lines between other queries and moves trailing comments to the next line.
BEFORE (with cursor in the last line):
Code:
# 1st query:
SELECT * FROM table1;
# 2nd query:
SELECT * FROM table2;
SELECT * FROM table3; # this was the 3rd query
SELECT * FROM table4; # this was the 4th query
# the last one (5th) to be formatted:
SELECT * FROM table5;
AFTER F12:
Code:
# 1st query:
SELECT * FROM table1;
# 2nd query:
SELECT * FROM table2;
SELECT * FROM table3;
# this was the 3rd query
SELECT * FROM table4;
# this was the 4th query
# the last one (5th) to be formatted:
SELECT *
FROM table5;
I thing it is at least “srange” that SQLyog somehow formats all other queries (removes blank lines and re-arranges comments) after pressing “F12” which should only format the current query.