Heyo! I have a spreadsheet for all of the servers I have with sites and their version numbers on them. I am wanting another sheet to pull the sites that are under a certain version number so I know what sites need to be updated. When doing so I get the following error.
Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " <DECIMAL_LITERAL> ".6 "" at line 1, column 50. Was expecting one of: "and" ... "or" ... ")" ...
Here's my query:
=query({'Heyo1 - CLOUD'!A:G;Heyo2!A:G;Heyo3!A:G;Heyo4!A:G;'Heyo4 - VPS'!A:G;'Heyo5 - VPS'!A:G}, "Select * Where (Col2 = 'Wordpress' and Col4 < 3.9.6 or Col2 = 'Joomla' and Col4 < 3.8.7 ) order by Col2 DESC ")
Any help would be appreciated!
It's complaining about the .6
because Google Spreadsheet thinks your query has an invalid decimal:
Col4 < 3.9.6
And also
Col4 < 3.8.7
But since these are version numbers, you'll need to compare these as strings (see the caveat below).
Based on your comments you can probably get away with the following:
=query({'Heyo1 - CLOUD'!A:G;Heyo2!A:G;Heyo3!A:G;Heyo4!A:G;'Heyo4 - VPS'!A:G;'Heyo5 - VPS'!A:G}, "Select * Where (Col2 = 'Wordpress' and Col4 < '3.9.6' or Col2 = 'Joomla' and Col4 < '3.8.7' ) order by Col2 DESC ")
Keep in mind that if, for whatever reason, you end up with a version number like 3.20.0
that it is considered smaller than 3.3.0
when comparing strings. If this happens you would probably need to have a custom function where you tokenize the version numbers by splitting the string by the period and process each element separately.