You can include the following control logic in the SQL queries.
While loops
If.. elseif.. else... endif blocks
The syntax of while loops is as follows
WHILE expression;
<statements>
WEND
The syntax of IF statements is as follows
IF expression
<statements>
optionally one or more blocks
ELSEIF expression
<statements>
optionally
ELSE
<statements>
ENDIF
It is possible to break out of loops by using the BREAK keyword e.g.
IF $x>0 AND $y>0
BREAK
ENDIF
this breaks out of the loop which immediately contains the BREAK keyword.
If the SQL contains a WHILE loop then a progress bar appears and you can break into the query.