Andy > == relevance ?? > > ... or define a calculated field for these "relevance"... and order the > results by this value... > > SELECT (sex = 1 AND country = 'CA') AS relevance, sex, country > FROM table > WHERE sex = 1 > ORDER BY 1 DESC > > ... note the relevance includes all the fields... and the where just the > mandatory conditions... the order must be DESC, because the "relevance" is 1 > if the two conditions are match... and 0 if not
you can define a more sophisticated relevance function... for example, if you want to search three different terms... example terms... sex = 1 age = 30 country = 'CA' [in MySQL]... you can define relevace as... (sex = 1) + (age = 30) + (country = 'CA') relevance will be... 3 if the three conditions are match 2 if just two conditions are match 1 if just one condition is match 0 if non is match if you are trying to define an "any word" query... you can show just the rows (where relevance > 0)... if you are trying to define an "all words" query... you can show the rows where relevance == 3... or re-define the query and include all the columns in the where clause !! 8-) jaime -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]