Bug #471 In correct result for the Field1+Field2 in like condition.
Submitted: 21 May 2003 7:44 Modified: 21 May 2003 8:04
Reporter: somsamai pokchai Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.12 OS:Linux (linux and windows platform)
Assigned to: CPU Architecture:Any

[21 May 2003 7:44] somsamai pokchai
Description:
mysql> select bilno,bildesc from tbgltrn;
+-------+---------+
| bilno | bildesc |
+-------+---------+
| 123   | 222     |
| 785   | 2122    |
| 111   | 111     |
+-------+---------+
3 rows in set (0.00 sec)

mysql> select bilno,bildesc from tbgltrn where bilno+bildesc like '%12%';
Empty set (0.00 sec)

 select bilno,bildesc from tbgltrn where bilno+bildesc like '%12%';  

 Why above Query statement is not correct result. really this Query must show 2 record. it not a Empty set.

Thank you.

How to repeat:
[21 May 2003 8:04] Indrek Siitan
If you add up the two values in your example, they will be 345, 2907 and 222. None of them 
match %12%, so an empty result set is a completely expected result.

If you are just trying to find records that contain 12 in either bilno or bildesc, the correct queries 
would be:  

SELECT bilno,bildesc FROM tbgltrn WHERE concat(bilno,bildesc) like '%12%';
SELECT bilno,bildesc FROM tbgltrn WHERE bilno like '%12%' or bildesc like '%12%';