in line 166: sql += (sql.length === 0 ? '' : ', ') + SqlString.escapeId(key) + ' = ' + SqlString.escape(val, true, timeZone); should be: sql += (sql.length === 0 ? '' : 'and ') + SqlString.escapeId(key) + ' = ' + SqlString.escape(val, true, timeZone);