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 works great for me. Is 'user' your actually table name and is it possible 
that the table name is being confused with the 'user' table in the MySQL 
database?
 
Good Luck

>>> "Matt Babineau" <[EMAIL PROTECTED]> 6/23/05 1:50:12 PM >>>
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....

SELECT first_name, lastname FROM user WHERE CONCAT(first_name, ' ',
last_name) LIKE '%$user%'

Does this make sense? The CONCAT function was the closest I found to try and
do what I want to do. I alread tried this:

SELECT concat(first_name, ' ', last_name) as fullname FROM user...

This did not work. If anyone has any ideas on how to search for users when
the first_name and last_name fields are broken up I'm all ears!


Thanks,

Matt Babineau
Criticalcode
858.733.0160
[EMAIL PROTECTED] 
http://www.criticalcode.com 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql 
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] 



Reply via email to