我有一列:account_type,其中包含四个字符。d
, h
, v
, a
. 现在,如果 account_type 是d
then 它应该显示DBA
, if a
then application
, if v
then vendor
, and if h
then human
。我试过这个查询。
SELECT da.account_name, da.account_id,da.manager_lastname, da.manager_firstname,
dap.live_password_change, dap.dev_password_change, das.status_desc,
REPLACE(RTRIM(CONCAT(IF(da.account_type = 'd', 'DBAs', 'NO'))), ' ', ', ')
FROM dba_account da
LEFT JOIN dba_account_password dap ON da.account_id = dap.account_id
LEFT JOIN dba_account_status das ON da.status = das.status_id
WHERE CAST(da.account_name AS BINARY) RLIKE '[a-z]'
AND da.account_name NOT RLIKE '[#$\\\\////]'
ORDER BY da.account_name
但我不知道如何比较 4 个条件。请问有什么建议吗?