Re: ORDER BY relevance DESC query
| From: | Adriano Rodrigo Guerreiro Laranjeira | Date: | Tue, 12 Apr 2011 12:40:09 +0000 |
| Subject: | Re: ORDER BY relevance DESC query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47758@lists.php.net to get a copy of this message | ||
Hey friend.
The problem is here:
( SELECT
reference, organization FROM ministry_profiles...
In a subselect, you must select just one column. You are selecting two "reference" and "organization".
If you really need both, so you must do two subselects: one for "reference" and another for "organization".
Cheers!
Adriano Laranjeira.
São Paulo - Brazil.
On Tue, 12 Apr 2011 04:00:15 -0400 "Ron Piggott" <ron.piggott@actsministries.org> wrote: I am programming the search feature for a directory. I am trying to make the query display the results in order of relevance (Greatest to least). I thought I had to perform the query similar to a column being selected in order to sort the results by "relevance". What changes do I need to make to my query for it to work correctly? The mySQL query is giving me the error message: #1241 - Operand should contain 1 column(s) The FULLTEXT index contains: organization address_line_1 address_line_2 city province_state postal_zip_code country telephone toll_free fax email website Presently the mySQL query is: SELECTreference,organization, ( SELECTreference,organizationFROMministry_profilesWHERE MATCH(ministry_profiles.organization,ministry_profiles.address_line_1,ministry_profiles.address_line_2,ministry_profiles.city,ministry_profiles.province_state,ministry_profiles.postal_zip_code,ministry_profiles.country,ministry_profiles.telephone,ministry_profiles.toll_free,ministry_profiles.fax,ministry_profiles.ministry_profiles.website) AGAINST ('$search') ANDlive= 1 ) AS relevance FROMministry_profilesWHERE MATCH(ministry_profiles.organization,ministry_profiles.address_line_1,ministry_profiles.address_line_2,ministry_profiles.city,ministry_profiles.province_state,ministry_profiles.postal_zip_code,ministry_profiles.country,ministry_profiles.telephone,ministry_profiles.toll_free,ministry_profiles.fax,ministry_profiles.ministry_profiles.website) AGAINST ('$search') ANDlive= 1 ORDER BY relevance DESC