I have a table like this:
// mytable
+----+--------+
| id | name |
+----+--------+
| 1 | Jack |
| 2 | |
| 3 | Peter |
| 4 | |
| 5 | |
| 6 | Alvin |
+----+--------+
Also the output of this query is always 1
:
SELECT ... (mytable.name IS NOT NULL) as col ... FROM ...
//=> echo result["col"]; -> always it will be "1"
Now, how can I change empty records to NULL
? Because I want it returns 1
just for where there is a name and if there is not any name I want to it returns 0
.
Actually I want something like this:
// newtable
+----+--------+
| id | name |
+----+--------+
| 1 | Jack |
| 2 | Null |
| 3 | Peter |
| 4 | Null |
| 5 | Null |
| 6 | Alvin |
+----+--------+
How can I convert my table to this ^ ?