What will be the SQL statement for this scenario ?
tbl_user_account
id INT(11)
name varchar(100)
username varchar(25)
password varchar(25)
active int(1)
_____________________________________
|id|name | username|password |active|
_____________________________________
|1 |John | jhon123 | p@ssw0rd | 1 |
|2 |Maria| maria321| p@ss | 0 |
I wanted to fetch all the record but the active field must output
“YES” if it’s 1 or “No” if it’s 0
I wanted this OUTPUT :
|id|name | username|password |active|
_____________________________________
|1 |John | jhon123 | p@ssw0rd | Yes |
|2 |Maria| maria321| p@ss | No |
do I need to create a function or just simply an if statement?
Try this: