Re: How to SELECT something (CONCAT) and search the field

2005-06-23 Thread Devananda
While the query "WHERE expr LIKE '%$user%'" works without fail, it can not use an index, and thus on large tables will be exceedingly slow. mysql> explain select last, first from users where concat(last,first) like '%user%'\G *** 1. row ***

Re: How to SELECT something (CONCAT) and search the field

2005-06-23 Thread Ed Reed
I do this all the time and it works flawlessly. Just like your example and even more extreme. I use this technique to provide search mechamisms for my applications. ex, SELECT ID FROM table WHERE concat(field1, field2, field3,...{all the fields in the table}) Like '%searchstring%'; This w

RE: How to SELECT something (CONCAT) and search the field

2005-06-23 Thread mfatene
s in the first > and last name columns > 'Billy Ray' Smith and John 'Von Hoenhiem' would cause problems > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 23, 2005 4:05 PM > To: Matt Babineau > Cc: my

RE: How to SELECT something (CONCAT) and search the field

2005-06-23 Thread Ben Kutsch
5 PM To: Matt Babineau Cc: mysql@lists.mysql.com Subject: Re: How to SELECT something (CONCAT) and search the field Hi, what's your version ? in 4.11 the two forms work : mysql> select concat(firstname,' ','lastname') from names; +---

Re: How to SELECT something (CONCAT) and search the field

2005-06-23 Thread mfatene
sorry for the first select (bad copy of a string 'lastname'): mysql> select concat(firstname,' ',lastname) from names where concat(firstname,' ',lastname) like 'Jean Dupond%'; ++ | concat(firstname,' ',lastname) | ++ | Jean Dupond

Re: How to SELECT something (CONCAT) and search the field

2005-06-23 Thread mfatene
Hi, what's your version ? in 4.11 the two forms work : mysql> select concat(firstname,' ','lastname') from names; +--+ | concat(firstname,' ','lastname') | +--+ | Jean lastname| +--+

Re: How to SELECT something (CONCAT) and search the field

2005-06-23 Thread David Turner
select first_name, lastname from user where first_name like '%$user%' or last_name like '%$user%' ; --- Matt Babineau <[EMAIL PROTECTED]> wrote: > Hey All- > > Got a fun question - I hit the manual but not much > luck on my question. I > want to combine 2 fields and then search them > > SE