Re: Creating an INDEX on multiple tables?
| From: | Chris | Date: | Fri, 22 Oct 2010 05:32:17 +0000 |
| Subject: | Re: Creating an INDEX on multiple tables? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47415@lists.php.net to get a copy of this message | ||
On 22/10/10 15:24, Ron Piggott wrote:
The query works using UNION ALL and MATCH ( ) AGAINST --- one table at a time for the MATCH. The down side is that each SELECT is giving it's own search results. The directory listings are being displayed multiple times when one of the SELECTS produces it as a result. How do I limit the results? Can I do this some how with results.reference and results.organization (I made the UNION ALLs sub queries)Get rid of the group by references inside each bit and move it to the outer: SELECT reference, organization FROM ( SELECT
ministry_profiles.reference, ministry_profiles.organization FROM
...
UNION ALL
SELECT ministry_profiles.reference,
...
)
GROUP BY reference, organization;
You'll get one reference per organization.
--
Postgresql & php tutorials
http://www.designmagick.com/