I have this update query:
Update Products
Set Color_ID =
(Select DISTINCT Colors.Color_ID
>From Colors, Products
Where Colors.Hex_Code = Products.Hex_Code)
When I run it, I get:
Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an _expression_.
The statement has been terminated.
How do I fix this?
Thanks.
----- Original Message -----
From: Ramirez, Ruben - Curtis HQ
To: SQL
Sent: Tuesday, February 03, 2004 8:42 AM
Subject: RE: Insert Sub-Query Issue
Try running it this way.
Insert Into Colors
(Color_Code)
(SELECT DISTINCT Product.Color_Code
FROM Products, Colors
Where Colors.Hex_Code = Products.Hex_Code)
-----Original Message-----
From: Bruce Sorge [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 03, 2004 9:36 AM
To: SQL
Subject: Insert Sub-Query Issue
I have a sub-query that I am using to insert some data into a database:
Insert Into Colors
(Color_Code)
(SELECT DISTINCT Color_Code
FROM Products
Where Colors.Hex_Code = Products.Hex_Code)
When I run this, I get the message:
Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'Colors' does not match with a table name or alias name
used in the query.
Why is this?
If I put a single quote around Colors.Hex_Code, then I get 0 row(s)
affected.
Thanks,
Bruce
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
