Hi, I am new to Zend. I want to construct a query from multiple words with LOGIC search option (or/AND) I am trying to build the query something like this $query = new table(); //table is table name in database $query = ($table->select() ->from($table)); $query->where('col1~* ? ', $searchkeyword) ->orwhere('col12~* ?', $searchkeyword) ->orwhere('col3~* ?', $searchkeyword) ->orwhere('col14~* ?', $searchkeyword) ->orwhere('col15~* ?', $searchkeyword) ->orwhere('col6~* ?', $searchkeyword) ; I want to construct a query which is equivalent to ----------------------------------- SELECT "tableName".* FROM "scemaName"."tablename" WHERE ((col1 ~* 'b' ) OR (col2 ~* 'b') OR (col3 ~* 'b') OR (col4 ~* 'b') OR (col5 ~* 'b') OR (col6 ~* 'b')) OR ((col1 ~* 'c' ) OR (col2 ~* 'c') OR (col3 ~* 'c') OR (col4 ~* 'c') OR (col5 ~* 'c') OR (col6 ~* 'c') ) AND ((col1 ~* 'd' ) OR (col2 ~* 'd') OR (col3 ~* 'd') OR (col4 ~* 'd') OR (col5 ~* 'd') OR (col6 ~* 'd')) OR ((col1 ~* 'e' ) OR (col2 ~* 'e') OR (col3 ~* 'e') OR (col4 ~* 'e') OR (col5 ~* 'e') OR (col6 ~* 'e')) ; ---------------------------------- Can anybody suggest me how to generate the above mentioned query
View this message in context: Query construct - Multiple Word Logic search
Sent from the Zend DB mailing list archive at Nabble.com.
2009年1月16日星期五
订阅:
博文评论 (Atom)
没有评论:
发表评论