Removed quotes from column names in generated sql outside the select
clases.
Added quotes to some more column referenes in the generated sql