Re: Creating an INDEX on multiple tables?
| From: | Ron Piggott | Date: | Fri, 22 Oct 2010 00:31:57 +0000 |
| Subject: | Re: Creating an INDEX on multiple tables? | ||
| References: | 1 2 3 4 5 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47411@lists.php.net to get a copy of this message | ||
Very much so. Thank you Bastien. I have never used an OUTER join before and didn't know it would be required for this project. Ron
--------------------------------------------------
From: "Bastien" <phpster@gmail.com>
Sent: Thursday, October 21, 2010 8:03 PM
To: "Ron Piggott" <ron.piggott@actsministries.org>
Cc: "Artur Ejsmont" <ejsmont.artur@gmail.com>; <php-db@lists.php.net>
Subject: Re: [PHP-DB] Creating an INDEX on multiple tables?
On 2010-10-21, at 7:38 PM, "Ron Piggott" <ron.piggott@actsministries.org> wrote:I am still struggling with this query still although I have made great progress. The following query (below) executes successfully. Right now the query returns no rows. I believe this is because there isn't automatically a record in the following three tables.Ron, Try using a left outer join from the table that has records. The inner join won't return any rows if one record in one table is null. A left outer join will take all records from the left (first) table regardless of data being null in the other rows. Does that make sense? Bastien=ministry_profiles_activityministry_profile_categoriesministry_profiles_listing_detailsThe bare minimum for a listing is only a record in he tableministry_profilesIs there a way to modify this query to accommodate only a record in the tableministry_profilesRon? SELECTministry_profiles.reference,ministry_profiles.organizationFROM ( ( (ministry_profilesINNER JOINministry_profiles_listing_detailsONministry_profiles.reference=ministry_profiles_listing_details.ministry_profile_reference) INNER JOINministry_profiles_activityONministry_profiles.reference=ministry_profiles_activity.ministry_profiles_reference) INNER JOINministry_profile_categoriesONministry_profiles.reference=ministry_profile_categories.ministry_profiles_reference) INNER JOINministry_categoriesONministry_profile_categories.ministry_categories_reference=ministry_categories.referenceWHERE 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')