MySQL Forums
Forum List  »  PHP

Re: nested select statement syntax error
Posted by: Roland Bouman
Date: July 14, 2005 12:07PM

This is because of your subquery, that is the SELECT bit between the parentheses

Subqueries are supported as of MySQL 4.1

Most of this can be solved by a join though:

SELECT pur_order.*
FROM pur_order
INNER JOIN pur_item
ON pur_order.req_id = pur_item.req_id
WHERE pur_item.account_number = '12345'

but as you are using the limit 1, i suspect you could need to 'flatten' your result by adding a DISTINCT to the select

SELECT DISTINCT pur_order.col1, ...pur_order.col n

or a GROUP BY after your WHERE:

GROUP BY pur_order.col1, ...pur_order.col n

G'luck!

Options: ReplyQuote




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.