我正在运行以下查询
SELECT accounts.name, accounts_cstm.account_number_c,validated_c,chkcustomer_c,
users.user_name FROM
accounts_cstm
LEFT OUTER JOIN
accounts
ON accounts.id = accounts_cstm.id_c
LEFT OUTER JOIN
users
ON accounts.assigned_user_id = users.id WHERE accounts.name = '1234'
这是我的网络应用程序
中的结果我想在验证和客户
中显示是或否1将=是,0将=否
我该怎么做?
答案 0 :(得分:1)
SELECT accounts.name, accounts_cstm.account_number_c,
CASE
WHEN validated_c = 1
THEN 'yes'
ELSE 'no'
END as validated
,chkcustomer_c,users.user_name FROM...
答案 1 :(得分:0)
您可以像这样使用CASE
SQL语句:
SELECT
[…],
CASE validated
WHEN 1 THEN 'yes'
WHEN 0 THEN 'no'
END
FROM …