Subject | Re: Update more than one column in only one row with a trigger: |
---|---|
Author | fridge_n |
Post date | 2009-08-02T22:01:07Z |
Thanks Kanka ,
Your advice helped.
I have tried your code, it didn't work but it gave me the missing link I was looking for.
Problem solved!
Although I find the double âwhere field_1 = new.field_aâ annoying the version beneath works fine:
as
begin
if (old.field_a is null and new.field_a>0) then
update table_2
set new.field_b = (select field_2 from table_1 where field_1 = new.field_a),
new.field_c = (select field_3 from table_1 where field_1 = new.field_a)
;
end
Regards,
fridge_n
Your advice helped.
I have tried your code, it didn't work but it gave me the missing link I was looking for.
Problem solved!
Although I find the double âwhere field_1 = new.field_aâ annoying the version beneath works fine:
as
begin
if (old.field_a is null and new.field_a>0) then
update table_2
set new.field_b = (select field_2 from table_1 where field_1 = new.field_a),
new.field_c = (select field_3 from table_1 where field_1 = new.field_a)
;
end
Regards,
fridge_n
--- In firebird-support@yahoogroups.com, Kanka sumatra <javakqj@...> wrote:
>
>
> Â Have you tried this:
> as
> begin
> if (old.field_a is null and new.field_a> 0) then
> update table_2
> set (new.field_b) = (select field_2 Â from table_1),set ( new.field_c) = (select field_3 from table_1)
> where field_1 = new.field_a) ;
> end
>
> --kqj