我有一个SQL问题,如何根据查询MAX()
和MIN()
来减少昨天的值?
SELECT mesin,
(SELECT value FROM `exa` WHERE Tanggal in
(select MAX(Tanggal)
FROM exa WHERE Tanggal))-(SELECT value FROM `exa`
WHERE Tanggal in (select MAX(Tanggal)
FROM exa WHERE Tanggal >= CURRENT_DATE() - INTERVAL 1 DAY AND Tanggal < CURRENT_DATE() ORDER BY Tanggal)) AS hasil FROM `exa`
WHERE Tanggal in (SELECT MAX(Tanggal) FROM exa WHERE Tanggal)![enter image description here](https://i.stack.imgur.com/I2P8c.png)