Re: SELECT 1 FROM DUAL WHERE 2 = '2asdfasdf' RETURNS 1. WHY?
pablo pablo,
Dual table is a dummy one used for calcualtion.if u display anything on columns it vl shows the result. in ur case 1 is column name
mysql> SELECT 1 FROM DUAL WHERE 2 = '2asdfasdf';
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+-----------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: '2asdfasdf' |
+---------+------+-----------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT null FROM DUAL ;
+------+
| NULL |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
Regards,
Raj
d_rajoracledba@yahoo.com