Topic: Script editor SQL multiline queries

Is there a way to write multiline SQL queries within the script editor? It becomes easily difficult to follow a pretty long query.

I would like to be able to write

'SELECT columns
FROM table
JOIN table2 on tableid=table2id
WHERE condition='my condition'
AND second_condition='my second condition'
AND third condition="'+fieldObject.txt+'";'

ETC...

Re: Script editor SQL multiline queries

You can write multi-line queries anywhere in the program. It is not necessary to write everything in one line.
In a script it would look like this:

'SELECT namefields FROM table '+
'WHERE ... AND '+
'...AND '+
' ... ORDER BY ... '

Re: Script editor SQL multiline queries

Thanks Sparrow!

Re: Script editor SQL multiline queries

Just don't forget to add a space before continuing the query on a new line otherwise except after a coma or you will get an error.

It should look like:

'SELECT namefields FROM table '+
' WHERE ... AND '+
' ...AND '+
'  ... ORDER BY ... '