Home > Net >  Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "b
Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "b

Time:06-14

When I am trying to use create this function. =QUERY(XXXXXXXXXX!$A$1:$CJ,"select BL,BM,BN,BK,BP,BQ,BR,BO,BT,BU,BV,BS,BX,BY,BZ,BW,CB,CC,CD,CA,CF,CG,CH,CE where A > date '2022-03-21'") I get the following error.

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "by" "BY "" at line 1, column 47. Was expecting one of: "true" ... "false" ... "date" ... "timeofday" ... "datetime" ... "timestamp" ... "min" ... "max" ... "avg" ... "count" ... "sum" ... "no_values" ... "no_format" ... "is" ... "null" ... "year" ... "month" ... "day" ... "hour" ... "minute" ... "second" ... "millisecond" ... "with" ... "contains" ... "starts" ... "ends" ... "matches" ... "like" ... "now" ... "dateDiff" ... "quarter" ... "lower" ... "upper" ... "dayOfWeek" ... "toDate" ... ... <INTEGER_LITERAL> ... <DECIMAL_LITERAL> ... <STRING_LITERAL> ... <QUOTED_ID> ... "(" ... "-" ... "min" ... "max" ... "count" ... "avg" ... "sum" ... "year" ... "month" ... "day" ... "hour" ... "minute" ... "second" ... "millisecond" ... "now" ... "dateDiff" ... "lower" ... "upper" ... "quarter" ... "dayOfWeek" ... "toDate" ... "(" ... <STRING_LITERAL> ... <DECIMAL_LITERAL> ... <INTEGER_LITERAL> ... "-" ... "true" ... "false" ... "date" ... "timeofday" ... "datetime" ... "timestamp" ... ... <QUOTED_ID> ... "min" ... "max" ... "avg" ... "count" ... "sum" ... "no_values" ... "no_format" ... "is" ... "null" ... "year" ... "month" ... "day" ... "hour" ... "minute" ... "second" ... "millisecond" ... "with" ... "contains" ... "starts" ... "ends" ... "matches" ... "like" ... "now" ... "dateDiff" ... "quarter" ... "lower" ... "upper" ... "dayOfWeek" ... "toDate" ...

I have tried removing "BY" and the function works perfectly, I have looked at the format for column BY and its the same as all the other columns.

I have recently just started learning how to use the query function and I am not sure what I am doing wrong

CodePudding user response:

use backquotes for BY column:

=QUERY(XXXXXXXXXX!A1:CJ,
 "select BL,BM,BN,BK,BP,BQ,BR,BO,BT,BU,BV,BS,BX,`BY`,BZ,BW,CB,CC,CD,CA,CF,CG,CH,CE 
  where A > date '2022-03-21'")
  • Related