是否可以使用 QUERY 实现多阶段排序?

Is it possible to implement multi-stage SORT using QUERY?

https://docs.google.com/spreadsheets/d/1XoxAY8MEgrGrpG1yJ2VthHDOGr6u2pBZC1YotpDfslE/edit?usp=sharing

Tab Deck Trends 单元格 A3 包含 QUERY 命令,您可以在其中查看当前排序顺序。

我想要实现的是:

任何 Col E 等于 4 的行,我希望 secondary 排序基于 Col F

所有其他行我希望 secondary 排序基于 Col D(当前设置)。

是否可以将多个排序规则合二为一QUERY

尝试:

=QUERY({QUERY({
 'Combined Opp Meta'!A2:G11; 'Combined Opp Meta'!A14:G23; 'Combined Opp Meta'!A26:G35},
 "where Col5 = 4
  order by Col5 desc,Col6 desc", 0);
 QUERY({
 'Combined Opp Meta'!A2:G11; 'Combined Opp Meta'!A14:G23; 'Combined Opp Meta'!A26:G35},
 "where Col5 <> 4
  order by Col5 desc,Col4 desc", 0)},
 "limit 12", 0)

数组文字修复:

=QUERY({IFERROR(QUERY({
 'Combined Opp Meta'!A2:G11; 'Combined Opp Meta'!A14:G23; 'Combined Opp Meta'!A26:G35},
 "where Col5 = 4
  order by Col5 desc,Col6 desc", 0), {"","","","","","",""});
 IFERROR(QUERY({
 'Combined Opp Meta'!A2:G11; 'Combined Opp Meta'!A14:G23; 'Combined Opp Meta'!A26:G35},
 "where Col5 <> 4
  order by Col5 desc,Col4 desc", 0), {"","","","","","",""})},
 "where Col1 is not null limit 12", 0)