MySQL Forums
Forum List  »  Newbie

Re: MySQL Query for datatabels
Posted by: James Lawrie
Date: March 17, 2021 11:34PM

May be i need to create a nested sql query the below doesn't work:

/* FILTER OUT THE DATA BASED ON THE ID AND SEARCH VALUE */
SELECT project_manager_id FROM tritech_reporting.job j WHERE j.project_manager_id IN
(
/* SELECT ALL THE DATA */
SELECT j.id AS job_id, j.project_manager_id, j.request, j.total, j.est_labor_hours, j.est_gross_profit, j.act_labor_hours, j.remaining, c.id AS customerID, c.company_name, si.name AS site_name, cc.type
FROM tritech_reporting.job j
INNER JOIN tritech_reporting.site si ON j.site_id = si.id
INNER JOIN tritech_reporting.customer c ON j.customer_id = c.id
INNER JOIN tritech_reporting.cost_center cc ON j.id = cc.job_id
WHERE cc.type = 'Product' OR cc.type = 'Monitoring' OR cc.type = 'Projects Direct' OR cc.type = 'Projects Indirect'
GROUP BY job_id
ORDER BY job_id DESC
)
AND j.project_manager_id = 7 AND c.company_name LIKE '%Spot%';

Options: ReplyQuote


Subject
Written By
Posted
March 17, 2021 10:00PM
Re: MySQL Query for datatabels
March 17, 2021 11:34PM


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.