MySQL Forums
Forum List  »  Knowledge Base

Re: Constraint help
Posted by: Paul Svirin
Date: October 05, 2009 05:16PM

What about a query:

INSERT INTO <tbl>(primary_ind, user_id)
SELECT * (SELECT <..> as primary_id, <..> as user_id) a
WHERE NOT EXISTS ( SELECT <tbl>.primary_id=a.primary_id AND <tbl>.user_id=a.user_id AND <tbl>.primary_id='Y' );

------------
StarWind Software developer ( http://www.starwindsoftware.com )

Options: ReplyQuote


Subject
Views
Written By
Posted
2689
October 03, 2009 02:29PM
Re: Constraint help
1355
October 05, 2009 05:16PM


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.