How can I do an update to a table where I dont want to allow records to have
a field(s) which occur in another record, whenm each record has a unique
integer id. For example, suppose I have a table setup as:
"id INTEGER(11) PRIMARY KEY NOT NULL AUTO_INCREMENT," +
"activities_id INTEGER(11)," +
"sombody VARCHAR(60),"+
"something VARCHAR(255),"+
and I have a record I want to INSERT to this table, but only if, say, there
is not already a record there that has both 'somebody' and 'activities_id'
in the table already.
Is there an expeditious way to do this, without examining each record in the
table? Thank you, Ike
Joe Weinstein - 21 Nov 2003 16:53 GMT
> How can I do an update to a table where I dont want to allow records to have
> a field(s) which occur in another record, whenm each record has a unique
[quoted text clipped - 11 lines]
> Is there an expeditious way to do this, without examining each record in the
> table? Thank you, Ike
Sure. create a unique index for the table on (activities_id, somebody)
Joe Weinstein at BEA
Abdullah Kauchali - 23 Nov 2003 09:54 GMT
"Joe Weinstein" <joeNOSPAM@bea.com> wrote in message
> Sure. create a unique index for the table on (activities_id, somebody)
Brilliant.