📜  mysql select true or false - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:36.503000             🧑  作者: Mango

代码示例1
SELECT IF(count(*) > 0, "yes", "no") AS output FROM users WHERE name="admin";
# output = "yes" or "no" 
SELECT IF(count(*) > 0, 1, 0) AS output FROM users WHERE name="qwerty";
# output = 1 or 0