mysql查询

flvtvl50  于 2021-06-15  发布在  Mysql
关注(0)|答案(1)|浏览(262)

这个问题在这里已经有答案了

选择一列中具有非空值的最新记录(3个答案)
三小时前关门了。
我使用的是grafana,我需要使用查询调用adl\ u ex\ u ante\ u price的最新值,其中的值不为null(如下所示)。我有每一行的相关时间戳。

我尝试过的代码描述如下:

SELECT
  gas_date AS "time",
  adl_ex_ante_price
FROM gas_market_prices
ORDER BY gas_date
WHERE
  NOT NULL
insrf1ej

insrf1ej1#

如果你想要最新的- null 价格,你可以过滤, order by 以及 limit :

select gas_date, adl_ex_ante_price 
from gas_market_prices 
where adl_ex_ante_price is not null
order by gas_date desc limit 1

相关问题