Re: [SQL] HELP: aggregating insert rule for multirow inserts.

2005-05-06 Thread a3a18850
Quoting Mikey <[EMAIL PROTECTED]>: > What about this as a rule. It seems to work for me. > > create or replace rule critter_counter as > on INSERT to critter do ( > > insert into zoostats > select distinct new.legs > where new.legs not in (select legs from zoostats); > >u

Re: [SQL] HELP: aggregating insert rule for multirow inserts.

2005-05-05 Thread Mikey
What about this as a rule. It seems to work for me. create or replace rule critter_counter as on INSERT to critter do ( insert into zoostats select distinct new.legs where new.legs not in (select legs from zoostats); update zoostats set headcount = ( select c

[SQL] HELP: aggregating insert rule for multirow inserts.

2005-05-04 Thread Mischa Sandberg
I'm having a problem with the use of the NEW rowset, in a rule intended to aggregate across inserts. I've never really grokked how NEW and OLD really work, syntactically, other than that they seem to be implicit in every top-level FROM clause, and any mention elsewhere gets an error: '42P01: re