Hi all,

I've seen some very advanced selects in the postings 
from this group and hope someone can help me.

I'm working on a search page for visitors.  They can 
enter a surname to search our records.  The problem is
that there are three different surname fields in each record:

PrincipalSurname1
PrincipalSurname2
PrincipalSurname3

I really don't think most of the records use all three
fields but we added them because there is a need for them.

I need to join these fields and then see if they match
what the visitor enters ($surname).

I was thinking I could use this:

SELECT CONCAT('PrincipalSurname1', 'PrincipalSurname2', 
               'PrincipalSurname3') AS FullLastName
FROM tableName
WHERE FullLastName='".$surname."'";

But I just read today that you can't use an alias in the
where clause.  I understand why, but now the only thing
I know how to do is to make a temp table up first, but
I really don't want to do that because there are so many
records, and I don't want this to take too long.

I've seen many advanced queries that still boggle my mind,
so I'm hoping I can go without the temp table, but will
accept that if there is no other way to accomplish this.

Thanks in advance if anyone can help me out.
Tanya Holliday








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/CefplB/TM
--------------------------------------------------------------------~-> 

The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to