最后日期 - 查询 - Google 工作表 - 重复

Last Date - Query - Google Sheets - Duplication

我有一个 table 包含以下数据:

Column A: 国家页面

Column B: Link 到 post

Column C: 日期 post编辑

我创建了以下查询来获取每个 Country Page posted 的最后日期:

=QUERY('Post Level'!A:C, "select A, max(C) where A<>'#N/A' and A<>'' group by A label max(C) 'Last Posted Date'",1)

查询完美无缺。我还想在最后一个 post 中添加一个 link。所以我将其更改为:

=QUERY('Post Level'!A:C, "select A,B max(C) where A<>'#N/A' and A<>'' group by A,B label max(C) 'Last Posted Date'",1)

这个版本不行。我得到每个国家/地区的重复条目。

理想情况下,我希望看到:Country PageLast Date Country PostedLink to last post

这是一个概念证明,它是 do-able:

=ArrayFormula(iferror(vlookup({unique(A:A)&query(A:C, "select max(C) group by A offset 1 label max(C) 'Date'")},{A:A&C:C,B:B},2,false),""))

所以我将国家和最后日期连接在一起,并将它们用作查找值以获取关联的 Link。

使用 Unique 而不是查询来获取国家列表的原因是您不能只输入

select A group by A

您必须至少有一个聚合。只要唯一 returns 国家的顺序与分组依据相同(它应该这样做),这将正常工作。