[nycphp-talk] MySQL query question
Matt Juszczak
matt at atopia.net
Wed Nov 17 15:08:04 EST 2004
Why not just %name% or %name or name% ?
On Tue, 16 Nov 2004, Joel De Gan wrote:
> 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
>
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
>
>
> !DSPAM:419a2749602611012812855!
>
More information about the talk
mailing list