简体   繁体   中英

Query in Google Sheets

I am new to SQL and querying with google sheets. I am trying to do a query in google sheets with two tables ('0112-0119' and '2020 Jan') in which I am trying to say, if the value A is the same in the two tables, select the column value, AI, from the table, '0112-0119'.

This is my SQL code:

SELECT '0112-0119'.AI FROM '0112-0119', '2020 Jan' WHERE '0112-0119'.A = '2020 Jan'.A

I am trying to translate this to a query in google sheets:

=QUERY({'0112-0119'!A2:BB13;'2020 Jan'!A1:AB25}, “select '0112-0119'.AI where '0112-0119'.A = '2020 Jan'.A')

but it doesn't work and keeps giving me #ERROR!

Instead of determining whether the value of A is the same in both tables, I can also return the value of AI from '0112-0119', if A is not null in both tables.

try:

=QUERY({'0112-0119'!AI1:AI25;'2020 Jan'!A1:A25}, 
 "select Col1 
  where Col2 = '2020 Jan'", 0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM