On Fri, Jan 7, 2011 at 9:46 AM, Toby Hart Dyke <t...@hartdyke.com> wrote:
> On 1/7/2011 12:10 AM, Fahim M wrote:
>> I have a certain number of mysql tables(relation), say 50, some of them
>> having 5 fields and some with 6 fields. a particular search item may be
>> found in multiple tables with multiple rows. I am using a loop to find all
>> My problem is I want to first combine all those results and then find all
>> the unique entries. (the query results may overlap).
>> What is the best way to do it?
> If you're looking for unique results, do a UNION query for all the tables.
> You'll need to add a dummy field for the 5-field tables, and make sure the
> field names are the same (use <oldfieldname> AS <newfieldname> to make sure
> everything ends up the correct result column). UNION queries automatically
> remove duplicates.
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
Though from the sounds of it, there is a problem with the table design
if you have multiple results in multiple tables
Cat, the other other white meat
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php