|
Posted by Erland Sommarskog on 12/17/06 23:15
info@bodykind.com (info@bodykind.com) writes:
> Erland, your SQL worked perfectly. Have tested it on several different
> orders and works fine. I only want the solution to work in SQL Server
> anyway so it's not a problem if it won't work in access.
Glad to hear that it worked out!
I like to add that the thing parentheses is something called a derived
table. Logically, it is a temporary table within the query, but it is
not materialised, and the optimizer may recast computation order as long
as it does not affect the result. It's a very powerful feature to build
complex queries in SQL.
Derived tables are part of ANSI SQL, so it is that part which is special
for SQL Server. The proprietary part lies in the FROM clause which is not
part of ANSI SQL for the UPDATE and DELETE statement. (And the JOIN clause
is part of FROM.)
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|