SQL Search Question

2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 11, 2011   (RSS)

By everbatim - March 10, 2011

I need to use the SQL "where" statement to filter results from 2 different fields (from the same table). What I'm trying to do is check all the records of a certain table and only return results that match either field. I tried using an "or" statement, however that just renders the search useless. I can successfully narrow the results searching only 1 field, but not when I add the OR statement where I think it should go.

So, I have a multi-record table, called WEBINARS which contains many fields. I want the page to search the PRESENTER field AND CO_PRESENTER field (both are simple lists) and only display records that match a single presenter name. Here is the code I tried, which does not work.

list($webinarsRecords, $webinarsMetaData) = getRecords(array(
'tableName' => 'webinars',
'allowSearch' => '0',
'where' => 'Presenter="name1"' or 'Co_Presenter="name1"',
));


Any thoughts? Again, I want to search 2 fields for the same value and only return the matching results.

Thanks in advance!