Subject | Re: [Firebird-Architect] SQL Update and Delete |
---|---|
Author | Arno Brinkman |
Post date | 2004-10-13T17:04:38Z |
Hi,
DELETE FROM
Table2 T
WHERE
EXISTS(SELECT 1 FROM Table1 K
WHERE K.KeyField = T.KeyField) and
T.FieldX = Value
UPDATE
Table1 K
SET
Field = (SELECT T.Field2 FROM Table2 T
WHERE K.KeyField = T.KeyField and T.FieldX = Value)
WHERE
EXISTS(SELECT 1 FROM Table2 T
WHERE K.KeyField = T.KeyField and T.FieldX = Value)
I understand that the proposed UPDATE should be more effective.
This is not an SQL-standard supported syntax, how many other engines support
this syntax? (What about Oracle, MySQL, ...)
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://80.126.130.81
> I would like to see this kind of SQL syntax for Updates and DeletesIs this the same as :
> like in M$ SQL Server:
>
> DELETE T
> FROM Table1 K
> JOIN Table2 T
> ON K.KeyField = T.KeyField
> WHERE T.FieldX = Value
DELETE FROM
Table2 T
WHERE
EXISTS(SELECT 1 FROM Table1 K
WHERE K.KeyField = T.KeyField) and
T.FieldX = Value
> UPDATE K SETand this the same as :
> Field = T.Field2
> FROM Table1 K
> JOIN Table2 T
> ON K.KeyField = T.KeyField
> WHERE T.FieldX = Value
UPDATE
Table1 K
SET
Field = (SELECT T.Field2 FROM Table2 T
WHERE K.KeyField = T.KeyField and T.FieldX = Value)
WHERE
EXISTS(SELECT 1 FROM Table2 T
WHERE K.KeyField = T.KeyField and T.FieldX = Value)
I understand that the proposed UPDATE should be more effective.
This is not an SQL-standard supported syntax, how many other engines support
this syntax? (What about Oracle, MySQL, ...)
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://80.126.130.81