无法在查询中传递十进制值?

Unable to pass decimal value in query?

嘿嘿!我有一个 spreadsheet 用于我拥有的所有服务器及其网站及其版本号。我想要另一个 sheet 来提取特定版本号下的站点,以便我知道哪些站点需要更新。这样做时出现以下错误。

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" ... ")" ...

这是我的查询:

=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 ")

如有任何帮助,我们将不胜感激!

它抱怨 .6 因为 Google 电子表格认为您的查询有无效的小数:

Col4 < 3.9.6

还有

Col4 < 3.8.7

但由于这些是版本号,您需要将它们作为字符串进行比较(请参阅下面的注意事项)。

根据您的评论,您可能可以逃避以下问题:

=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 ")

请记住,无论出于何种原因,如果您最终得到像 3.20.0 这样的版本号,那么在比较字符串时,它被认为小于 3.3.0。如果发生这种情况,您可能需要一个自定义函数,通过按句点拆分字符串并分别处理每个元素来标记版本号。