NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL query question

Joel De Gan joel at tagword.com
Tue Nov 16 06:16:03 EST 2004


Hi,
In like comparisions you can use '%%%' for wildcard checking
so, for anywhere
SELECT * FROM table WHERE field LIKE '%%%name%%%' 
for right side:
SELECT * FROM table WHERE field LIKE '%%%name' 
and for left
SELECT * FROM table WHERE field LIKE 'name%%%' 

That is one way to do it.
-joel

On Tue, 2004-11-16 at 16:08, DeWitt, Michael wrote:
> Does anyone know if there is a way to write a query in a v3 engine to do a
> query comparing two columns using like?
> 
> I would like to count all rows where the last name appears in the company
> name.
> 
> In sql server a query like this works:
> 
> select count(*) from table where company like rtrim(last_name)+'%'
> 
> Thanks in advance.
> 
> Mike
> 
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
> 
-- 
joeldg - developer, Intercosmos media group.
http://lucifer.intercosmos.net




More information about the talk mailing list