mysql去除换行和空格

UPDATE t_rest_food_info SET food_name = REPLACE(REPLACE(food_name,
CHAR(10), ''), CHAR(13), '') where `month` ='2018-06' and city_code =17 and rest_id ='173403' and food_id = '1234298509';

多对多
UPDATE t_huoguo th,(SELECT a.rest_id,

sum(trp.order_month_sales) as sameRestNum


from t_rest_pandect_info trp

inner JOIN
(
SELECT th.rest_id,th.rest_name,trp.longitude,trp.latitude,th.city_code from
t_huoguo th
LEFT JOIN
t_rest_pandect_info trp
ON
trp.`month` = '2018-05' and trp.city_code = th.city_code
AND
trp.rest_id = th.rest_id

GROUP BY th.rest_id
)
as a
ON
trp.latitude BETWEEN a.latitude-1.5/111 and a.latitude+1.5/111
and trp.longitude BETWEEN a.longitude-(1.5/111)/COS(RADIANS(a.latitude)) and a.longitude+(1.5/111)/COS(RADIANS(a.latitude))
where trp.`month` ='2018-05' and trp.city_code = a.city_code

GROUP BY a.rest_id) as restInfo set th.RestOrderSaleNum05 = restInfo.sameRestNum where th.rest_id = restInfo.rest_id

原文地址:https://www.cnblogs.com/coriander/p/9364395.html