Add a computed column = (emp_id * 1000 + task_id * 10 + qual_type) set this column unique.
In the example below you would get 124011 and 124012 Bernie Lis ----- Original Message ----- From: "Bill Downall" <[EMAIL PROTECTED]> To: "RBase List Server" <[EMAIL PROTECTED]> Sent: Wednesday, October 02, 2002 11:18 AM > I am trying to write a rule that accomplishes the following goal: > > Rule will prevent a row from being added to the table Qualified_Detail under > the following condition: > > if an emp_id, task_id, and qual_type = 1 exist, then do not allow > the row to be added. > > This means that for that same emp_id and task_id, that if qual_type = > something other than 1, the row should be added. > > Already existing row: > empid =124 > task_id =1 > qual_type = 1 > cladode = 8/1/2002 > > Do not allow the following to be added: > > empid = 124 > task_id = 1 > qual_type = 1 > qual_date = 8/5/2002 > > BUT DO allow the following to be added: > > empid = 124 > task_id = 1 > qual_type = 2 > qual_date = 8/5/2002 > > > The rule I wrote is to Add/modify if the select fails > > WHERE qual_type NOT IN (select ssn task_id qual_type FROM qualified_detail > t1 WHERE t1.ssn = qualified_detail.ssn AND t1.task_id = qualified_detail.task_id AND > t1.qual_type = 1) > > Otherwise display message "Employee has already been initially qualified on > this task" > > What is happening now is that any attempt to insert a row into the table is > failing under this rule, regardless of what the qual_type is.. > > I know how to write a rule testing for uniqueness (which is basically what > this is), but throwing the qual_type = 1 is perhaps throwing a wrench into > things. > > Thanks for any assistance .. > > > Charles Sikora > Coordinator, Gas Storage > Manlove Field > Peoples Energy Corporation ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/
