Google Spreadsheet的Query函数返回带有order by的空数据

时间:2017-03-08 12:20:59

标签: google-sheets google-sheets-query

Google Spreadsheet的Query函数返回带有order by的空数据。 以下是正常运行的查询:

=QUERY('OtherListName'!A1:C;"Select A, B, C";1)

此查询完全返回您期望的内容:范围A1:C的内容(在我的情况下有6行)。 然后我尝试订购返回的数据:

=QUERY('OtherListName'!A1:C;"Select A, B, C order by A, B";1)

此查询仅返回第一行(包含标题),仅此而已。 OtherListName中的原始数据集仅包含字符串和整数。

我想要的是按列A排序,然后按列B排序。两列只包含字符串。相应的整数位于C列中。

请就此分享一些建议,我还没有找到任何建议。同时我将继续我的实验,找出这个“错误”的原因。 感谢。

1 个答案:

答案 0 :(得分:4)

尝试过滤掉空行...

=QUERY('OtherListName'!A1:C; "Select A, B, C where A <>'' order by A, B";1) 

或者,如果A中的数据是数字

=QUERY('OtherListName'!A1:C; "Select A, B, C where A is not null order by A, B";1)