Answers for "mysql if true"

SQL
2

mysql select true or false

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
Posted by: Guest on July-02-2021
2

if inside select mysql

SELECT IF(1>3,'true','false');
Posted by: Guest on April-30-2020
-1

if condition mysql

IF(condition, value_if_true, value_if_false)
Posted by: Guest on October-24-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language