Hello everyone, I have a SQL query that I am not sure how to do.
I have two tables (tableA and tableB). They have a common field called name. I want to do a search on both tables and find all the records from either table where the name contains my search string. I tried using an union, like below, but that didn't give me what I needed. It would only return the results that matched from tableA, but no matches from tableB. SELECT tableA.name,tableA.id,tableA.active FROM tableA WHERE tableA.name LIKE '%SEARCH%' UNION SELECT tableB.Name, tableA.id, tableA.active FROM tableB,tableA WHERE tableB.name LIKE '%SEARCH%' AND tableA.name=tableB.name I am not sure if I need to do a union, or use something else. Any help with this would be greatly appreciated. -- Doug Registered Linux User #285548 (http://counter.li.org) ---------------------------------------- Never trust a computer you can't throw out a window. -- Steve Wozniak 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/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/php_mysql/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> 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/
