I've got the following query, which is huge. As I just found out, that I can't use more than 40 ORs in a Where clause I get the 'Query ids too Complex Error'. Although, I can't figure out how to change the Query, in order to split it up into 2 WHERE clauses or something else.
Has anybody an idea how to modify this Query?
Thanks]
$sql_query3 = "SELECT * FROM dbtable WHERE (index LIKE '%$search_str%'".
" OR title LIKE '%$search_str%'OR author LIKE '%$search_str%'".
" OR summary LIKE '%$search_str%' OR source LIKE '%$search_str%'".
" OR theme1 LIKE '%$search_str%' OR theme2 LIKE '%$search_str%'".
" OR theme3 LIKE '%$search_str%' OR theme4 LIKE '%$search_str%'".
" OR theme5 LIKE '%$search_str%' OR organisation LIKE '%$search_str%'".
" OR organisation2 LIKE '%$search_str%'".
" OR organisation3 LIKE '%$search_str%'".
" OR organisation4 LIKE '%$search_str%'".
" OR organisation5 LIKE '%$search_str%'".
" OR location LIKE '%$search_str%' OR hyperlink LIKE '%$search_str%'".
" OR entry_date LIKE '%$search_str%'".
" OR update_date LIKE '%$search_str%'".
" OR document_type LIKE '%$search_str%'".
" OR archive LIKE '%$search_str%'".
" OR synthesis LIKE '%$search_str%'".
" OR comments LIKE '%$search_str%'".
" OR priority LIKE '%$search_str%'".
" OR synthesis_flag LIKE '%$search_str%') OR (index LIKE '%$search_str2%'".
" OR title LIKE '%$search_str2%'OR author LIKE '%$search_str2%'".
" OR summary LIKE '%$search_str2%' OR source LIKE '%$search_str2%'".
" OR theme1 LIKE '%$search_str2%' OR theme2 LIKE '%$search_str2%'".
" OR theme3 LIKE '%$search_str2%' OR theme4 LIKE '%$search_str2%'".
" OR theme5 LIKE '%$search_str2%' OR organisation LIKE '%$search_str2%'".
" OR organisation2 LIKE '%$search_str2%'".
" OR organisation3 LIKE '%$search_str2%'".
" OR organisation4 LIKE '%$search_str2%'".
" OR organisation5 LIKE '%$search_str2%'".
" OR location LIKE '%$search_str2%' OR hyperlink LIKE '%$search_str2%'".
" OR entry_date LIKE '%$search_str2%'".
" OR update_date LIKE '%$search_str2%'".
" OR document_type LIKE '%$search_str2%'".
" OR archive LIKE '%$search_str2%'".
" OR synthesis LIKE '%$search_str2%'".
" OR comments LIKE '%$search_str2%'".
" OR priority LIKE '%$search_str2%'".
" OR synthesis_flag LIKE '%$search_str2%') ORDER BY update_date DESC";
Has anybody an idea how to modify this Query?
Thanks]
$sql_query3 = "SELECT * FROM dbtable WHERE (index LIKE '%$search_str%'".
" OR title LIKE '%$search_str%'OR author LIKE '%$search_str%'".
" OR summary LIKE '%$search_str%' OR source LIKE '%$search_str%'".
" OR theme1 LIKE '%$search_str%' OR theme2 LIKE '%$search_str%'".
" OR theme3 LIKE '%$search_str%' OR theme4 LIKE '%$search_str%'".
" OR theme5 LIKE '%$search_str%' OR organisation LIKE '%$search_str%'".
" OR organisation2 LIKE '%$search_str%'".
" OR organisation3 LIKE '%$search_str%'".
" OR organisation4 LIKE '%$search_str%'".
" OR organisation5 LIKE '%$search_str%'".
" OR location LIKE '%$search_str%' OR hyperlink LIKE '%$search_str%'".
" OR entry_date LIKE '%$search_str%'".
" OR update_date LIKE '%$search_str%'".
" OR document_type LIKE '%$search_str%'".
" OR archive LIKE '%$search_str%'".
" OR synthesis LIKE '%$search_str%'".
" OR comments LIKE '%$search_str%'".
" OR priority LIKE '%$search_str%'".
" OR synthesis_flag LIKE '%$search_str%') OR (index LIKE '%$search_str2%'".
" OR title LIKE '%$search_str2%'OR author LIKE '%$search_str2%'".
" OR summary LIKE '%$search_str2%' OR source LIKE '%$search_str2%'".
" OR theme1 LIKE '%$search_str2%' OR theme2 LIKE '%$search_str2%'".
" OR theme3 LIKE '%$search_str2%' OR theme4 LIKE '%$search_str2%'".
" OR theme5 LIKE '%$search_str2%' OR organisation LIKE '%$search_str2%'".
" OR organisation2 LIKE '%$search_str2%'".
" OR organisation3 LIKE '%$search_str2%'".
" OR organisation4 LIKE '%$search_str2%'".
" OR organisation5 LIKE '%$search_str2%'".
" OR location LIKE '%$search_str2%' OR hyperlink LIKE '%$search_str2%'".
" OR entry_date LIKE '%$search_str2%'".
" OR update_date LIKE '%$search_str2%'".
" OR document_type LIKE '%$search_str2%'".
" OR archive LIKE '%$search_str2%'".
" OR synthesis LIKE '%$search_str2%'".
" OR comments LIKE '%$search_str2%'".
" OR priority LIKE '%$search_str2%'".
" OR synthesis_flag LIKE '%$search_str2%') ORDER BY update_date DESC";