Try splitting this line out. Watch for the necessary white spaces in the query:
var sql = 
  "select ..." + 
  "union " +