[visualization-api] Re: Need help using the QUERY "WHERE" clause with multiple conditions

2023-07-04 Thread Glenn Barker
... and I should have mentioned from the start that I'm doing this in 
Google Sheets.

On Tuesday, July 4, 2023 at 3:03:33 AM UTC-5 Glenn Barker wrote:

> Thank you. I tried, but no luck.
> I know I could use a JOIN function to create the string *(value 1, value 
> 2, ... *) from the column of values (numbers in text) that I want to use 
> as the query key, but unfortunately (according to the Google 
> Visualization API Query Language 
>  
> reference), 
> the IN operator is not available for use with the WHERE clause.  Maybe 
> there's a workaround for IN?
> On Tuesday, July 4, 2023 at 1:08:25 AM UTC-5 Joe Davies wrote:
>
>> Have you tried using the IN operator which is a standard method for SQL. 
>> If non numeric you need to enclose values with single quotes. 
>> HTH
>>
>> SELECT *column_name(s)*
>> FROM *table_name*
>> WHERE *column_name* IN (*value1*,* value2*, ...);
>>
>> On Tuesday, July 4, 2023 at 1:41:57 AM UTC+1 Glenn Barker wrote:
>>
>>> Hi, I'm totally new to this and need some advice.
>>>
>>> I'm currently using the QUERY function with the WHERE clause to filter 
>>> an IMPORTRANGE.  The WHERE clause has multiple conditions separated by OR 
>>> operators. Example of a working query that has 4 conditions using OR 
>>> operators:
>>>
>>> QUERY(IMPORTRANGE("[URL]","equipment!A2:T"),"SELECT Col1, Col3, Col9, 
>>> Col10 WHERE (Col10 = '"!F3&"' or Col10 = '"!F4&"' or 
>>> Col10 = '"!F5&"' or Col10 = '"!F6&"')")  
>>>
>>> The OR operators work fine for me in the circumstance that my list of 
>>> conditions to filter against is short.  However, I want to be able to 
>>> filter the IMPORTRANGE against a column of values that changes and could be 
>>> dozens or hundreds of values long... far too big for using a hardcoded 
>>> string of OR statements.
>>>
>>> How can I QUERY the IMPORTRANGE against all the values listed in a 
>>> column as the conditions? If I use an array as the condition for the 
>>> query... for example...
>>>
>>>  QUERY(IMPORTRANGE("[URL]","equipment!A2:T"),"SELECT Col1, Col3, Col9, 
>>> Col10 WHERE Col10 = '"!*F3:F100*&"' ")
>>>
>>> ... it only returns the first condition in the column.  
>>>
>>> Greatly appreciate any response on how to solve this problem.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/79f9cee5-d428-4b51-88b0-4b7ad554ac00n%40googlegroups.com.


[visualization-api] Re: Need help using the QUERY "WHERE" clause with multiple conditions

2023-07-04 Thread Glenn Barker
Thank you. I tried, but no luck.
I know I could use a JOIN function to create the string *(value 1, value 2, 
... *) from the column of values (numbers in text) that I want to use as 
the query key, but unfortunately (according to the Google Visualization API 
Query Language 
 
reference), 
the IN operator is not available for use with the WHERE clause.  Maybe 
there's a workaround for IN?
On Tuesday, July 4, 2023 at 1:08:25 AM UTC-5 Joe Davies wrote:

> Have you tried using the IN operator which is a standard method for SQL. 
> If non numeric you need to enclose values with single quotes. 
> HTH
>
> SELECT *column_name(s)*
> FROM *table_name*
> WHERE *column_name* IN (*value1*,* value2*, ...);
>
> On Tuesday, July 4, 2023 at 1:41:57 AM UTC+1 Glenn Barker wrote:
>
>> Hi, I'm totally new to this and need some advice.
>>
>> I'm currently using the QUERY function with the WHERE clause to filter an 
>> IMPORTRANGE.  The WHERE clause has multiple conditions separated by OR 
>> operators. Example of a working query that has 4 conditions using OR 
>> operators:
>>
>> QUERY(IMPORTRANGE("[URL]","equipment!A2:T"),"SELECT Col1, Col3, Col9, 
>> Col10 WHERE (Col10 = '"!F3&"' or Col10 = '"!F4&"' or 
>> Col10 = '"!F5&"' or Col10 = '"!F6&"')")  
>>
>> The OR operators work fine for me in the circumstance that my list of 
>> conditions to filter against is short.  However, I want to be able to 
>> filter the IMPORTRANGE against a column of values that changes and could be 
>> dozens or hundreds of values long... far too big for using a hardcoded 
>> string of OR statements.
>>
>> How can I QUERY the IMPORTRANGE against all the values listed in a column 
>> as the conditions? If I use an array as the condition for the query... for 
>> example...
>>
>>  QUERY(IMPORTRANGE("[URL]","equipment!A2:T"),"SELECT Col1, Col3, Col9, 
>> Col10 WHERE Col10 = '"!*F3:F100*&"' ")
>>
>> ... it only returns the first condition in the column.  
>>
>> Greatly appreciate any response on how to solve this problem.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/27500880-c116-4e32-ba06-8973293e74c2n%40googlegroups.com.


[visualization-api] Re: Need help using the QUERY "WHERE" clause with multiple conditions

2023-07-04 Thread Joe Davies
Have you tried using the IN operator which is a standard method for SQL. If 
non numeric you need to enclose values with single quotes. 
HTH

SELECT *column_name(s)*
FROM *table_name*
WHERE *column_name* IN (*value1*,* value2*, ...);

On Tuesday, July 4, 2023 at 1:41:57 AM UTC+1 Glenn Barker wrote:

> Hi, I'm totally new to this and need some advice.
>
> I'm currently using the QUERY function with the WHERE clause to filter an 
> IMPORTRANGE.  The WHERE clause has multiple conditions separated by OR 
> operators. Example of a working query that has 4 conditions using OR 
> operators:
>
> QUERY(IMPORTRANGE("[URL]","equipment!A2:T"),"SELECT Col1, Col3, Col9, 
> Col10 WHERE (Col10 = '"!F3&"' or Col10 = '"!F4&"' or 
> Col10 = '"!F5&"' or Col10 = '"!F6&"')")  
>
> The OR operators work fine for me in the circumstance that my list of 
> conditions to filter against is short.  However, I want to be able to 
> filter the IMPORTRANGE against a column of values that changes and could be 
> dozens or hundreds of values long... far too big for using a hardcoded 
> string of OR statements.
>
> How can I QUERY the IMPORTRANGE against all the values listed in a column 
> as the conditions? If I use an array as the condition for the query... for 
> example...
>
>  QUERY(IMPORTRANGE("[URL]","equipment!A2:T"),"SELECT Col1, Col3, Col9, 
> Col10 WHERE Col10 = '"!*F3:F100*&"' ")
>
> ... it only returns the first condition in the column.  
>
> Greatly appreciate any response on how to solve this problem.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/cfd4c497-39ab-4153-9ac4-4296d3c0a951n%40googlegroups.com.