OR QUERY USING TWO TABLES

wxdqz

New Member
In Mysql I need to extract data from one table, using criteria that

1. comes from the same table
2. comes from a different table

I've tried:

SELECT d.* FROM WYISORG AS d, WYISCONTACT AS d1
LEFT OUTER JOIN d1 ON d.ORGID=d1.ORGID
WHERE
(d1.SURNAME LIKE '%$searchphrase%')
OR (d.ORGANIZATIONNAME LIKE '%searchphrase%')
OR (d.BRIEF LIKE '%$searchphrase%')
ORDER BY d.ORGANIZATIONNAME";


but it gives no result (although it doesn't give an error)

Do I need to create a temporary table and do the query twice? If so, how?

Thanks folks!
 
Back
Top