MySQL Forums
Forum List  »  PHP

Re: If selection results in too many rows
Posted by: Vemsom Helst
Date: June 07, 2017 07:41AM

Thanks. But I don't see how I can avoid it because I need to match on MATNR. Ive been looking for a subquery in my select statement. Something like this

Select
SELECT
A.VBELN AS SALES_DOCUMENT
,A.POSNR as ITEM
,(SELECT D.GEGRU D FROM @E_DB.MAEX where D.GEGRU='EU' and A.MATNR=D.MATNR) as EU
,(SELECT D.GEGRU D FROM @E_DB.MAEX where D.GEGRU='US' and A.MATNR=D.MATNR) as US
,(SELECT D.GEGRU D FROM @E_DB.MAEX where D.GEGRU='E1' and A.MATNR=D.MATNR) as E1
FROM TABLE1 A
LEFT JOIN TABLE2 D on A.MATNR=D.MATNR and D.ALAND='BE'

Or perhaps creating empty fields and doing an UPDATE to fill them..
Any suggestions?

Options: ReplyQuote


Subject
Written By
Posted
Re: If selection results in too many rows
June 07, 2017 07:41AM


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.