MySQL Forums
Forum List  »  Newbie

Re: SELECT 1 FROM DUAL WHERE 2 = '2asdfasdf' RETURNS 1. WHY?
Posted by: Rajkumar D
Date: August 13, 2010 04:56AM

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

Options: ReplyQuote


Subject
Written By
Posted
Re: SELECT 1 FROM DUAL WHERE 2 = '2asdfasdf' RETURNS 1. WHY?
August 13, 2010 04:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.