change SQL generation