Subject | Re: Multiple table update question |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-04-08T08:02:47Z |
If your suggestion works, then it's simpler than the way I normally do
things. I'm used to writing
UPDATE table1 T1
SET T1.field2 = (select T2.field2 FROM table2 T2
where T2.field1 = T1.field1)
where exists(select * from table2 T3
where T3.field1 = T2.field1)
Try Normans suggestion first and if it doesn't work, try mine.
HTH,
Set
things. I'm used to writing
UPDATE table1 T1
SET T1.field2 = (select T2.field2 FROM table2 T2
where T2.field1 = T1.field1)
where exists(select * from table2 T3
where T3.field1 = T2.field1)
Try Normans suggestion first and if it doesn't work, try mine.
HTH,
Set
--- In firebird-support@yahoogroups.com, Norman McFarlane wrote:
> As far as I can recall the syntax is like this
>
> update T1
> SET T1.field2 = T2.field2
> FROM table1 T1
> INNER JOIN table2 T2 on (T1.field1 = T2.field2);
>
> although I am open to correction. I have not used it for a while,
> and the syntax is somewhat arcane.
>
> If this does not work, let me know and I'll look it up in one of my
> SQL resources.
>
> Quoting Daniel Jimenez:
> >
> > So from what you mention, can I take this as FB does not allow the
> > following?
> >
> > UPDATE table1, table2
> > SET table1.field2 = table2.field2
> > WHERE table1.field1 = table2.field2;