Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIKE related question

Status
Not open for further replies.

786snow

Programmer
Nov 12, 2006
75
0
0
Is it possible to have OR with LIke, I am trying to do the following , whcih is obviously wrong as it is not working

Code:
select*  from products,  where category_id = 'ph100'  and features_camera LIKE '%2%' or '%3%'  order by auto_no desc LIMIT 0,10
 
select* from products, where category_id = 'ph100' and features_camera LIKE '%2%' or features_camera LIKE '%3%' order by auto_no desc LIMIT 0,10

or use regular expressions

select* from products, where category_id = 'ph100' and features_camera RLIKE '[2|3]+'
 
it's "wrong" because you forgot the parentheses...
Code:
select please
     , list
     , only
     , the
     , columns
     , you
     , need
  from products
 where category_id = 'ph100'  
   and [b][red]([/red][/b]
       features_camera LIKE '%2%' 
    or features_camera LIKE '%3%'
       [b][red])[/red][/b]
order 
    by auto_no desc LIMIT 0,10
:)

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top