NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL query question

Ophir Prusak prusak at gmail.com
Tue Nov 16 12:00:24 EST 2004


This should work (if you want full substring search).

select count(*) from table where company like concat('%',last_name,'%') 

On Tue, 16 Nov 2004 11:08:18 -0500, DeWitt, Michael
<mjdewitt at alexcommgrp.com> 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
>



More information about the talk mailing list