Compile SQL: reduce list of queries

- if a query is used twice during a statement, it will be added only once
- if a statement query is used twice, it will be added only once
Compile SQL: remove queries containing 'false'