MySQL查询1-
SELECT assets.name, models.model_number,
COUNT(CASE when (month(DATE_ADD(purchase_date, INTERVAL 1461 DAY)) BETWEEN 2 AND 4) AND Year(DATE_ADD(purchase_date, INTERVAL 1461 DAY))<=year(curdate()) THEN 1 end)
as total_count FROM assets, models WHERE assets.model_id = models.id AND status_id=30 or status_id=1
MySQL Query2-
SELECT assets.name, models.model_number,
COUNT(CASE when (month(DATE_ADD(purchase_date, INTERVAL 1461 DAY)) BETWEEN 2 AND 4) AND Year(DATE_ADD(purchase_date, INTERVAL 1461 DAY))<=year(curdate()) THEN 1 end)
as total_count FROM assets, models WHERE assets.model_id = models.id AND status_id=26 or status_id=1
现在我想将query1减去query2。有人可以在这里帮助我吗?
首次查询-结果
第二次查询-结果
现在我想要这样的东西...。