如何从配置单元获取最新的分区数据

我需要从具有最新分区的配置单元中的表中获取所有记录。该表由date,year,month分区,例如(date=25,year=2020,month=3),同样会有很多分区。

分区不是静态的,并且会经常更改。我正在尝试获取查询中的最新分区。 有人可以帮我写查询吗?

如何从配置单元获取最新的分区数据

kuuipoio 回答:如何从配置单元获取最新的分区数据

尝试一下:

select * 
  from your_table t
 where concat_ws('-',t.year,t.month,t.date) in (select max(concat_ws('-',s.year,s.month,s.date)) from your_table s)

也请阅读以下相关答案:

https://stackoverflow.com/a/59675908/2700344

https://stackoverflow.com/a/41952357/2700344

本文链接:https://www.f2er.com/2591115.html

大家都在问