如何进行查询以返回 yes/no
而不是 t/f
(true/false)?
目前的解决方案是:
SELECT credit_card_holders.token IS NOT NULL AS premium
我找到了一个 Ruby 解决方案: Rails (or Ruby): Yes/No instead of True/False
但如果可能的话,宁愿在 PostgreSQL 中进行。
最佳答案
最后是这样的:
(case when credit_card_holders.token IS NOT NULL then 'Yes' else 'No' end) AS premium
关于sql - 对于 PostgreSQL 中的 boolean 数据类型,输出 "yes/no"而不是 "t/f",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28959507/