Subject Re: [firebird-support] Insert from query, but changing one field?
Author Helen Borrie
At 07:50 PM 21/10/2003 -0300, you wrote:
>Hi,
>
>At October 21, 2003, 19:43, Helen Borrie wrote:
>
> > At 01:02 PM 21/10/2003 -0700, you wrote:
> >>However, this will make duplicate copies of the enrollment record, meaning
> >>that they'll still have classid 123. Somehow in the command, I need to
> >>change the CLASSID of the newly inserted rows to, say, 456.
>
> > Assuming you have a generator + trigger supplying the PK value, col1:
>
> > insert into enrollments (col2, col3, ...., classid, ....)
> > select col2, col3, ...., 456, ....
> > from enrollments
> > where classid <> 456
>
>I think it should be: where classid=123. Otherwise, it would copy the
>students from all the other classes and put them into one.

Quite true: my suggestion was based on Joe saying "What I want to do is
take all of the enrollments (rows in this table), and copy them to all to
another class. "

heLen