Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

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 
 
PREVIOUS NEXT
Tagged: #mysql #select #true #false
ADD COMMENT
Topic
Name
6+2 =