【发布时间】:2016-04-28 17:40:33
【问题描述】:
我正在使用 MySql 工作台从 Magento 数据库备份数据。这是我正在使用的查询:
Select FName.value AS 'FirstName' ,
LName.value AS 'LastName' ,
e.email,
Address1.value AS Address1,
City.value AS City ,
Province.value as Province ,
Country.value AS 'CountryCode' ,
Zip.value AS Zip ,
Phone.value AS Phone
FROM customer_entity e
JOIN customer_address_entity ae ON ae.parent_id = e.entity_id
JOIN customer_entity_int cei ON e.entity_id = cei.entity_id and cei.attribute_id=13 and cei.value=ae.entity_id
left JOIN customer_address_entity_varchar FName ON ae.entity_id = FName.entity_id and FName.attribute_id = (select attribute_id from eav_attribute where entity_type_id=2 and attribute_code='firstname')
left JOIN customer_address_entity_varchar LName ON ae.entity_id = LName.entity_id and LName.attribute_id= (select attribute_id from eav_attribute where entity_type_id=2 and attribute_code='lastname')
left JOIN customer_address_entity_varchar Zip ON ae.entity_id = Zip.entity_id and Zip.attribute_id = (select attribute_id from eav_attribute where entity_type_id=2 and attribute_code='postcode')
left JOIN customer_address_entity_varchar City ON ae.entity_id = City.entity_id and City.attribute_id= (select attribute_id from eav_attribute where entity_type_id=2 and attribute_code='city')
left JOIN customer_address_entity_varchar Phone ON ae.entity_id = Phone.entity_id and Phone.attribute_id = (select attribute_id from eav_attribute where entity_type_id=2 and attribute_code='telephone')
left JOIN customer_address_entity_varchar Province ON ae.entity_id = Province.entity_id and Province.attribute_id = (select attribute_id from eav_attribute where entity_type_id=2 and attribute_code='region')
left JOIN customer_address_entity_varchar Country ON ae.entity_id = Country.entity_id and Country.attribute_id = (select attribute_id from eav_attribute where entity_type_id=2 and attribute_code='country_id')
left JOIN customer_address_entity_text Address1 ON ae.entity_id = Address1.entity_id and Address1.attribute_id = (select attribute_id from eav_attribute where entity_type_id=2 and attribute_code='street')
我真正需要做的就是从 Address1 字段中删除新行,因为它破坏了我使用的 CSV 解析器。我试过了:
TRIM(\n FROM Address1.value) as Address1
在查询的第四行,但没有成功。我对 MySql 的了解显然是有限的,任何帮助都会为我节省数小时删除新行的时间。
【问题讨论】:
标签: mysql magento csv newline trim