我只想问一下如何在MySQL命令中转义像(“)和(,)这样的字符? 因为我正在尝试创建一个csv文件。而且我有成千上万的行。有些行由逗号(,)组成,其他行由(“)双qutoes组成。现在当我尝试导出我的表时。我无法获得与查询结果完全相同的正确行。
这是我的sql代码:
SELECT
cscart_products.product_id,
cscart_product_descriptions.product,
cscart_product_descriptions.short_description,
cscart_product_descriptions.page_title,
cscart_products.list_price AS list_price,
cscart_product_prices.price AS selling_price
FROM cscart_products
LEFT JOIN cscart_product_prices
ON cscart_products.product_id = cscart_product_prices.product_id
LEFT JOIN cscart_product_descriptions
ON cscart_products.product_id = cscart_product_descriptions.product_id
INTO OUTFILE 'C:/Users/ad00/Desktop/FIELDS/menu_fields.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
我希望你能帮助我。