2
当我运行SQL脚本以将数据从MySQL数据库中导出时,使用命令行,出现上述错误。 在phpMyAdmin中运行时,SQL查询可以正常工作,但仅在从命令行运行时会引发错误。错误在第1行:未知命令''
这里是我使用的命令行:
cat my_export | mysql -uxyzuser -pabcpassword mydb > export072911.txt
在my_export
的代码如下:
SELECT CONCAT(custfirstname, ' ', custlastname) AS fullname, custcompany, \
SPACE(10) AS custtitle, custaddressone, custaddresstwo, custcity, custstate, \
custzip, SPACE(10) AS dummy, custphone, SPACE(10) AS custfax, custemail, \
event_id, SPACE(10) AS ticket1, SPACE(10) AS ticket2, \
SPACE(10) AS ticket3, SPACE(10) AS ticket4, orderdate, b.quantity, \
FROM order_master a \
LEFT JOIN order_detail b ON b.order_master_id = a.id \
LEFT JOIN customer c ON c.email = a.custemail \
WHERE a.orderdate > '2010-12-01'\
AND a.event_id = '30' \
AND a.orderstatus = 'O' \
AND b.litype = 'ITEM' \
AND b.reftag = 'PKG' \
ORDER BY a.orderdate DESC;
想想你是如何在命令行上执行此操作的(例如在mysql工具中)。你可以输入/按enter/type /按回车键/ etc,直到你插入命令终止符';'命令行只是取数据。重定向:) – KevinDTimm
酷,这工作。非常感谢Michael和KevinDimim。 – newbie