I have this XML:
<product>
<id>3</id>
<name>myname</name>
<price>$34.00</price>
</product>
I also have a mysql table:
+-----------+--------+-------------+
| ID | Title | Price |
+-----------+--------+-------------+
| 1 | title1 | $19.00 |
| 2 | title2 | $24.00 |
+-----------+--------+-------------+
I'm trying to insert the xml file into the table with this code:
LOAD XML LOCAL INFILE 'pathtothefile/filename.xml'
INTO TABLE mytable
ROWS IDENTIFIED BY '<product>'
SET ID = id, Title=name, Price=price;
But I get this error #1054 - Unknown column 'name' in 'field list'
No comments:
Post a Comment