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]

Reply via email to