zwwcn

Just another WordPress.com site

update , delete and left join

UPDATE OP_CONTACT c
LEFT JOIN OP_CONTACTTYPE ct ON ct.CONTACT_ID = c.OBJECT_ID
LEFT JOIN OP_CUSTOMER_CONTACT_XREF ref ON ref.CONTACT_TYPE_ID = ct.OBJECT_ID
SET c.IS_BILLING = (ct.TYPE = “BillContact”)
WHERE ref.CUSTOMER_ID IS NOT NULL AND ct.TYPE IN (“ShipContact”,”OtherContact”,”BillContact”);

 

DELETEĀ  ad

FROM ADDRESS ad

LEFT JOIN CUSTOMER c ON c.ADDRESS_ID = ad.OBJECT_ID;

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: