Received: from exchhq01.usinspect.com (exchhq01.usinpect.com [208.233.45.2] (may be forged)) by hub.org (8.10.1/8.10.1) with ESMTP id e7BHFQG46737 for ; Fri, 11 Aug 2000 13:15:27 -0400 (EDT) Received: by exchhq01.usinspect.com with Internet Mail Service (5.5.2650.21) id ; Fri, 11 Aug 2000 13:14:49 -0400 Message-ID: From: "Madel, Kurt" To: pgsql-sql@postgresql.org Subject: Trying to Creat a Rule Date: Fri, 11 Aug 2000 13:14:42 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Archive-Number: 200008/77 Hello, I am trying to create a RULE that updates the size of a class when a student registers for that class and the register(module) table is updated, and subtract 1 from the given class size when a student drops a course. Actually, there is a class table and a module table. The class table's primary key is id, the module table consists of every module that a student can register for a given year containing a class id. I think I have the INSERT RULE down, but am not sure about the UPDATE RULE: CREATE RULE module_update AS ON UPDATE TO module.a_q1 DO SET class.size to class.size-1 WHERE class.id=old.a_q1 AND set class.size to class.size+1 WHERE class.id=new.a_q1; I am really not so sure about the 'and' part, but I need to do both updates on class, using different WHERE criteria. TIF, Kurt