我正在使用MySql工作台备份来自Magento数据库的数据。下面是我使用的查询:需要从MySql结果中修剪新行
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')
我真正需要做的是剥离新的线条勾勒出地址1场的,因为它打破了我使用CSV解析器。我试过了:
TRIM(\n FROM Address1.value) as Address1
对查询的第四行,但那是不成功的。我对MySql的知识显然是有限的,任何帮助都会为我节省几个小时来删除新行。
我需要所有的人,所以我不希望按日期有限制WHERE子句。我需要的是确保Address1.value中没有任何换行符(\ n)的方法。 – natep
如何尝试:其中address1.value NOT LIKE'/ n' 应该收集子字符串/ n并且不允许它。更多的是你在找什么? –