AhmedHuq
AhmedHuq

Reputation: 469

Google Sheet Query - WHERE clause to result from another query

I am new to Google Sheet query with a SQL Server background. My worksheet is here:

My example file

The file contains multiple worksheets. I am trying to write a query to get Employee Number from Employee Name and then use this result to get Employee's Assignment information.

Things I have tried so far:

Query to get Employee Number from Name: (this is working fine)

query(Individual!A2:AL25,"select N, Q, O where AL = 'Christian Slater'")

The above query returns certain columns for an Employee. Column N is Employee_Number.

Query to get Assignment End Date for that Employee:

=query(Assignments!A1:R1001,"select * where G = (query(Individual!A2:AL25,"select N, Q, O where AL = 'Christian Slater'"))")

I get a formula parse error - so obviously I am not using the correct syntax. I would appreciate if someone can point me to the right direction and useful resource.

Upvotes: 2

Views: 4310

Answers (1)

pnuts
pnuts

Reputation: 59450

Please try:

=query(Assignments!A1:R1001,"select A where G like '"&query(Individual!A2:AL25,"select N, Q, O where AL = 'Christian Slater'")&"' label(A) '' ")

Upvotes: 5

Related Questions