MYSQL error
Can anyone help me on this ?
1 Query
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
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=30 or status_id=1
Now i want to subtract query1 to query2.
First Query - Result
Name | Model Number | Total_Count
Windows Laptop E7440 12
Second Query - Result
Name | Model Number | Total_Count
Windows Laptop E7440 1
Now I want something like this….
Name | Model Number |Total_Count | Pending (Query1-Query2)
Windows Laptop E7440 12 11
Subject
Written By
Posted
MYSQL error
April 05, 2019 05:38AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.