Reputation: 72
I am running the following query
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'
here is my result in my web application
I want to display yes or no in validated and customer
1 will = yes and 0 will = no
How can i do this?
Upvotes: 0
Views: 72
Reputation: 2365
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...
Upvotes: 1
Reputation: 9509
You can use the CASE
SQL statement like this :
SELECT
[…],
CASE validated
WHEN 1 THEN 'yes'
WHEN 0 THEN 'no'
END
FROM …
Upvotes: 0