You need to use intvalue=1. The statement intvalue=’1’ is internally converted to cast(‘1’ as int) by MySQL.
Let us first create a table −
mysql> create table DemoTable1566 -> ( -> intvalue int -> ); Query OK, 0 rows affected (0.64 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1566 values(1); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1566 values(55); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable1566 values(75); Query OK, 1 row affected (0.32 sec) mysql> insert into DemoTable1566 values(90); Query OK, 1 row affected (0.19 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1566;
This will produce the following output −
+----------+ | intvalue | +----------+ | 1 | | 55 | | 75 | | 90 | +----------+ 4 rows in set (0.00 sec)
Here is the query to implement intvalue=1 −
mysql> select * from DemoTable1566 where intvalue=1;
This will produce the following output −
+----------+ | intvalue | +----------+ | 1 | +----------+ 1 row in set (0.00 sec)
Here is the query to intvalue=’1’ −
mysql> select * from DemoTable1566 where intvalue='1';
This will produce the following output −
+----------+ | intvalue | +----------+ | 1 | +----------+ 1 row in set (0.00 sec)