Hi Tanya, I think you were very close. Try this:
SELECT CONCAT(`PrincipalSurname1`, `PrincipalSurname2`, `PrincipalSurname3`) AS FullLastName FROM tableName WHERE CONCAT(`PrincipalSurname1`, `PrincipalSurname2`, `PrincipalSurname3`)='".$surname."'"; Best regards, Jim at iDimensionz.com -- http://www.iDimensionz.com Professional web site design and affordable web site hosting. ------------------------------------------------------------------------ Get Firefox! <http://www.spreadfirefox.com/?q=affiliates&id=38044&t=84> – Get the new open source web browser, FireFox, and enjoy features like pop up blocking, tabbed browsing and MUCH more! Get Thunderbird! <http://www.spreadfirefox.com/?q=affiliates&id=38044&t=178> – Get the new open source e-mail client, ThunderBird, and enjoy features like integrated spam filter, privacy protection, integrated RSS reader and MUCH more! Tanya wrote: > 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 --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/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/
