1

How do I include the column BY in a query?
I first tried =unique(query(data_table,"SELECT D, BY"))

Then, I tried to surround it with single quotes =unique(query(data_table,"SELECT D, 'BY'"))

  • Yes. I marked the question as answered way back when. I redid the acceptance today. Thanks! – John Faig Dec 8 '19 at 15:24
2

Short answer

Put BY column identifier between back quotes, =unique(query(data_table,"SELECT D, `BY`"))

Explanation

BY is a Google Query Language keyword. From https://developers.google.com/chart/interactive/docs/querylanguage#Identifiers

Identifiers

Identifiers (or IDs) are text strings that identify columns.

Important: If your identifier

  • Has spaces,
  • Is a reserved word,
  • Contains anything but alphanumeric characters or underscores ([a-zA-Z0-9_]), or
  • Starts with a digit

it must be surrounded by back-quotes (not single quotes).

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.