views:

31

answers:

2

I want to search number of strings in the Database (type: MYSQL) and I did this:

SELECT * 
  FROM `rooms` 
 WHERE `dates` LIKE '%09/08/10%' OR '%08/08/10%'

Why doesnt it work? when I removed the part of OR '%08/08/10%' it was working well, I think I use it not good. How should I do it?

+5  A: 
SELECT ... 
FROM rooms 
WHERE dates LIKE '%09/08/10%' 
  Or dates LIKE '%08/08/10%'
Thomas
There is a simple way than this? Thank you very much!
Luis
@Luis - As far as I know, there is no simpler means to do a series of wildcard searches. If you wanted an exact match, that would be different.
Thomas
*cough* FTS *cough*
OMG Ponies
You can also try ` WHERE dates REGEXP "0(9|8)/08/10"` (http://dev.mysql.com/doc/refman/5.0/en/regexp.html)
a1ex07
@OMG Ponies - *smack my head*. Of course. Need more coffee...
Thomas
+2  A: 

Try like this:

SELECT * 
FROM rooms 
WHERE 
      dates LIKE '%09/08/10%' 
      OR 
      dates LIKE '%08/08/10%'
leoinfo