0
我試圖爲我的數據庫創建一個視圖。mysql創建視圖列爲utf8_bin而不是utf8_general_ci
CREATE VIEW `latest` AS
SELECT r.id as recheck_id, f.id as failure_id, r.`when`,
case
when r.description like _utf8'dummy' then f.description
else r.description
end as description,
case
when r.technician_id is null then f.technician_id
else r.technician_id
end as technician_id,
case
when r.technician_id is null then f.tname
else r.name
end as tech_name,
case
when r.technician_id is null then f.tsurname
else r.surname
end as tech_surname,
f.customer_id, f.name as cust_name, f.surname as cust_surname, f.area,
case
when r.telephone is null then f.telephone
else r.telephone
end as telephone, mobile,
f.appliance_id, f.type, f.model, f.brand,
f.budget, f.advance_payment, f.final_price
FROM rechecks_with_info r
left join failures_with_info f on f.id = r.failure_id
where `when` =
(select max(r2.`when`)
from rechecks r2
where r.failure_id = r2.failure_id)
order by `when` desc;
一切工作正常,直到我嘗試搜索description
列
我得到一個錯誤Illegal mix of collations (utf8_bin,NONE) and (utf8_general_ci,COERCIBLE) for operation 'like'
內的字符串。
我檢查了特定列的排序規則,默認設置爲utf8_bin
。所有其他列在utf8_general_ci
。
有沒有一種方法可以指定我想要的視圖中特定列的排序規則?
我已經嘗試在description
列定義之後添加一個特定的排序規則,並且出現錯誤。