0
votes

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.

1
Can you share a copy of the spreadsheet you are working on, free of sensitive information?Iamblichus

1 Answers

0
votes

try:

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