RE: [PHP-WIN] MS SQL Question
| From: | Svensson, B.A.T. | Date: | Wed, 07 Feb 2001 18:44:09 +0000 |
| Subject: | RE: [PHP-WIN] MS SQL Question | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-5442@lists.php.net to get a copy of this message | ||
Syntax (simplified)
UPDATE <table_name>
SET <column_name> = {expression | DEFAULT | NULL}
FROM <table_source> [,...n]
WHERE <search_condition>
In the "FROM ... WHERE ..." construction is where you should place the
"other" table and the appropriate search conditions.
You can try this script to get a grip of it:
create table A (a int, b int)
create table B (c int, d int)
insert into A values (1,1)
insert into A values (2,1)
insert into A values (3,1)
insert into B values (1,4)
insert into B values (2,5)
update A set b = d
from B where a = c
select * from A
select * from B
drop table A
drop table B
>-----Original Message-----
>From: Conover, Ryan [mailto:Rconover@americanbridge.net]
>Sent: Wednesday, February 07, 2001 4:26 PM
>To: php-general@lists.php.net; php-windows@lists.php.net
>Subject: [PHP-WIN] MS SQL Question
>
>
>I am trying to update a table with data from another table
>within the same database with the following SQL
>
>UPDATE common SET common.[Extended Description] = extended.[Extended
>Description] WHERE common.[id] = extended.[Extended Description]
>
>the id is the primary key. I keep getting the following error.
>
>Server: Msg 107, Level 16, State 3, Line 1
>The column prefix 'extended' does not match with a table name
>or alias name
>used in the query.
>Server: Msg 107, Level 16, State 1, Line 1
>The column prefix 'extended' does not match with a table name
>or alias name
>used in the query.
>
>
>Anyone have any ideas.
>
>
>Ryan
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
>For additional commands, e-mail: php-windows-help@lists.php.net
>To contact the list administrators, e-mail:
>php-list-admin@lists.php.net
>