[英]Change value from 1 To Yes In MySQL select statement
我只能在表上選擇。
該表有一個名為 inty 的列,其值為 0 或 1
我目前選擇 inty 作為:
SELECT inty AS InternetApproved FROM Table1
有沒有辦法重新格式化 SQL SELECT 中的數據,以便如果值為 0 則將其設為 No,如果值為 1 則設為 Yes 以在輸出 SELECT 結果中顯示?
SELECT IF(inty = 1, 'YES', 'No') AS internetApproved FROM Table1
SELECT
CASE
WHEN inty = 0 then 'No'
WHEN inty = 1 then 'Yes'
ELSE 'Maybe'
END
AS InternetApproved
FROM Table1
select case when inty = 0 then 'no' else 'yes' end as newcolname from table1;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.