Is there a way to add a literal field at the end of a Google Sheets QUERY function similar to what you can do in SQL?
e.g. =QUERY(A:C,"SELECT A, B, C, D AS 'CURRENT DATA'",0)
Thanks, Stefan
Is there a way to add a literal field at the end of a Google Sheets QUERY function similar to what you can do in SQL?
e.g. =QUERY(A:C,"SELECT A, B, C, D AS 'CURRENT DATA'",0)
Thanks, Stefan
Guess, you mean this:
=QUERY(A:C,"SELECT A, B, C, 'D' label 'D' 'CURRENT DATA'",0)
see more info here
The formula above will populate letter 'D', lebaled as 'CURRENT DATA'.
If you want actual column D, then use range A:D
:
=QUERY(A:D,"SELECT A, B, C, D label 'D' 'CURRENT DATA'",0)
More columns
Also possible to add more columns in any order. This formula would work:
=QUERY(A1:C4,"SELECT A, C, 'D', B, date '2016-05-30', 500 label 'D' 'CURRENT DATA', date '2016-05-30' 'MY DATE', 500 'MY NUMBER'",0)
here we select:
A
C
All I had to do was:
=QUERY(A:C,"SELECT A, B, C, 'D'",0)
This will give a literal D
for all rows of your query.
© 2022 - 2024 — McMap. All rights reserved.