MySQL INSERT with table alias

Posted by Max Kielland on Stack Overflow See other posts from Stack Overflow or by Max Kielland
Published on 2011-01-17T10:29:22Z Indexed on 2011/01/17 10:53 UTC
Read the original article Hit count: 358

Hello,

I happen to have two columns having the same name as two SQL reserved words, Key and Value. When using the SELECT statement I can create a table alias and solve it that way.

Now I'm trying to INSERT data and it seems like you can't create table alias in the INSERT statement.

INSERT INTO attributeStrings ats
(ats.ItemID,ats.Key,ats.Value)
VALUES (3,'Categories','TechGUI')

I get error at 'ats (ats.ItemID,ats.Key,ats.Value) VALUES (3,'Categories','TechGUI')' indicating that alias can't be created.

Are there any ways to solve this without renaming the columns Key and Value?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysql-query