我有一张表entities
。在这张表中,我得到了列:Rank Name Spouse Level Online Class
如在站点 >>Class 中显示时所见,表中的数字值为 25 。145 .... 我希望以下消息显示为:number 25 displayed as Good
。number 145 displayed as Verygood
.
问问题
30 次
2 回答
1
SELECT
CASE Class
WHEN 25 THEN 'good'
WHEN 145 THEN 'very good'
END AS translatedNumbers
FROM yourTable
于 2012-11-09T10:21:12.813 回答
1
你需要类似的东西:
SELECT name,
IF(class=25,"Good",IF(class(145,"Verygood",class)) AS display
FROM yourtable
或者您可以使用case
:
SELECT name,
CASE class
WHEN 25 THEN "Good"
WHEN 125 THEN "Verygood"
ELSE class
END AS display
FROM yourtable
在这里阅读!
于 2012-11-09T10:21:26.953 回答