Query for Google Spreadsheet failed

I'm asking for the Google Spreadsheet and it gives me a bug in the last part of it. The query works with 3 data inserted by validation in boxes B1, D1 and B2.

Here's what I've

= if (AND (B1 = 0; B2 = 0; D1 = 0); IMPORTRANGE ("LINK"; "Llista! A6: S1000"); if (AND (B1> 1; B2> 1; D1 = 0); query (IMPORTRANGE ("LINK"; "Llista! A6: S1000"); "select * where Col6 =" & B1 & "and Col8 = & # 39;" & B2 & "" " request (IMPORTRANGE ("LINK"; "Llista!" A6: S1000 ");" select * where Col6 IN (& # 39; "& B1 &", "" & D1 & "") and Col8 = "" & B2 & "" ")))

That's the part I miss:

query (IMPORTRANGE ("LINK"; "Llista! A6: S1000"); "select * where Col6 IN (& # 39;" & B1 & "," "& D1" ") and Col8 =" " & B2 & "" ")))

The mistake that it gives me is the following:

Unable to parse the query string for the QUERY function, parameter 2: PARSE_ERROR: "" Col6 "" encountered at line 1, column 16. I was waiting at one of the following : "(" … "(" …