Re: Creating an INDEX on multiple tables?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux