MySQL Forums
Forum List  »  PHP

Problem with sub query
Posted by: Jonathan Bishop
Date: March 24, 2021 10:02AM

I'm having an issue with a query I am writing and can't figure out what the issue is. I created an alias for the table so I can reference the column I need from that table inside the subquery but I still get a syntax errror.

Any help would be appreciated.

SELECT
pd.enterprise,
COUNT(*) AS total
FROM
production_data pd
WHERE
enterprise = "EXXON" AND as400_ship_date = CAST("2021-03-02" AS DATE) AND hold_date = "0000-00-00" AND pd.id NOT IN(
SELECT
order_id
FROM
(
SELECT
MAX(id),
order_id
FROM
production_status
WHERE
order_id = pd.id AND dept_code = 13 AND status_id = 3
)
)

Options: ReplyQuote


Subject
Written By
Posted
Problem with sub query
March 24, 2021 10:02AM
March 24, 2021 04:20PM


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.