TBL_Practice
Practice_ID (PK)
Practice_Name
etc.
TBL_Branch
Branch_ID (PK)
Practice_ID (FK)
Branch_Suburb
Branch_Postcode
etc.
Each branch has multiple specialties that they can practice in
TBL_SPECIALTY
Specialty_ID (PK)
Specialty_Name (eg. family law)
Specialty_Tags (eg. contains a list of tags: marriage, divorce, custody)
Then there is a mapping table as such.
TBL_BRANCH_SPECIALTY_MAP
Branch_ID (FK)
Specialty_ID(FK)
Thats the database section, then on the frontend I then have a search engine with 3 textboxes.
[Practice Name or Part thereof]
[Practice Suburb or Postcode]
[Keywords]
If someone enters a keyword that appears in TBL_SPECIALTY.Specialty_Tags it should bring up a matching practice.
I have the first two boxes worked out but cannot figure out how to get the keywords working. (or if it can be done).
My SQL so far is:
Expand|Select|Wrap|Line Numbers
- SELECT TBL_PRACTICE.Practice_Name, TBL_BRANCH.Branch_Suburb, TBL_BRANCH.Branch_Postcode
- FROM TBL_PRACTICE INNER JOIN
- TBL_BRANCH ON TBL_PRACTICE.Practice_ID = TBL_BRANCH.Practice_ID
- WHERE
- TBL_PRACTICE.Practice_Name LIKE '% PARAMETER_PRACTICE %' AND (Suburb_Name LIKE '% PARAMETER_LOCATION %' OR Suburb_Postcode = ' PARAMETER_LOCATION ')