Subject Re: [Firebird-Architect] SQL Update and Delete
Author Daniel Rail
Hello Arno,

Wednesday, October 13, 2004, 2:04:38 PM, you wrote:


> Hi,

>> I would like to see this kind of SQL syntax for Updates and Deletes
>> like in M$ SQL Server:
>>
>> DELETE T
>> FROM Table1 K
>> JOIN Table2 T
>> ON K.KeyField = T.KeyField
>> WHERE T.FieldX = Value

> Is this the same as :

> DELETE FROM
> Table2 T
> WHERE
> EXISTS(SELECT 1 FROM Table1 K
> WHERE K.KeyField = T.KeyField) and
> T.FieldX = Value


>> UPDATE K SET
>> Field = T.Field2
>> FROM Table1 K
>> JOIN Table2 T
>> ON K.KeyField = T.KeyField
>> WHERE T.FieldX = Value

> and this the same as :

> 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, ...)

In MS-SQL's documentation it is mentioned that the proposed syntax is
not SQL standard. And, it's just an alternative to using subqueries
as outlined by Arno's examples above.

--
Best regards,
Daniel Rail
Senior Software Developer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)