469,081 Members | 1,803 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,081 developers. It's quick & easy.

QA tells me my table is ambiguous

Can someone help with this syntax? I have a non-sensicle example
below, but it illustrates the problem if you copy/paste into QA.

**********************************

use pubs
go

update authors set address = 'some address'
from authors a
inner join authors a2 on a.zip = a2.zip

---------------------------------------------

Server: Msg 8154, Level 16, State 1, Line 2
The table 'authors' is ambiguous.
**********************************

Jul 23 '05 #1
3 11664
It needs to know which alias to update a or a2.

update a set address = 'some address'
from authors a
inner join authors a2 on a.zip = a2.zip

Jackie

<jo************@inginix.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Can someone help with this syntax? I have a non-sensicle example
below, but it illustrates the problem if you copy/paste into QA.

**********************************

use pubs
go

update authors set address = 'some address'
from authors a
inner join authors a2 on a.zip = a2.zip

---------------------------------------------

Server: Msg 8154, Level 16, State 1, Line 2
The table 'authors' is ambiguous.
**********************************

Jul 23 '05 #2
thx!

Jul 23 '05 #3
Of course, instead of the Microsoft proprietary syntax, you could also
write this statement with the ANSI SQL compliant syntax, as follows:

-- Note: The update is still non-sensicle...
UPDATE Authors
SET Address = (
SELECT 'some address'
FROM Authors A2
WHERE A2.zip = Authors.zip
)

HTH,
Gert-Jan
jo************@inginix.com wrote:

Can someone help with this syntax? I have a non-sensicle example
below, but it illustrates the problem if you copy/paste into QA.

**********************************

use pubs
go

update authors set address = 'some address'
from authors a
inner join authors a2 on a.zip = a2.zip

---------------------------------------------

Server: Msg 8154, Level 16, State 1, Line 2
The table 'authors' is ambiguous.

**********************************

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by xuatla | last post: by
2 posts views Thread by James | last post: by
1 post views Thread by Alex Zhitlenok | last post: by
3 posts views Thread by Arpan | last post: by
1 post views Thread by rn5a | last post: by
8 posts views Thread by xtrigger303 | last post: by
12 posts views Thread by Nathan Sokalski | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.