NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL query question

DeWitt, Michael mjdewitt at alexcommgrp.com
Tue Nov 16 12:04:37 EST 2004


Ophir,

Yup.  Works like a charm.  Funny that the '+' concatentation character
doesn't work the same way.

Mike

> -----Original Message-----
> From:	Ophir Prusak [SMTP:prusak at gmail.com]
> Sent:	Tuesday, November 16, 2004 12:00 PM
> To:	NYPHP Talk
> Subject:	Re: [nycphp-talk] MySQL query question
> 
> 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
> >
> _______________________________________________
> 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