How To...
Hi,
My colleague is currently struggling over the following problem:
He has a table: parts(name, description, ...), the column in this table
`name' appears to have several aliases. For example, part A may be
referred to by `nameA', `nameB', or `nameC', etc.
What he would like to do is to retrieve the correct row(s) from the
parts table irrespective of which alias the user enters during the
initial query.
Can any one suggest a really good, efficient, way of retrieving data of
this type in this way?
My initial thoughts were to create a seperate alias table and populate
it with the part names and their aliases. For example:
alias(primaryName, aliasName). Then joining the parts and alias table on
alias.primaryName = parts.name would allow the alias.aliasName to be
queried with the end user search criteria and return the correct row(s)
from the parts table.
I think this would work with some provisos e.g. each part name _must_
appear in the alias table even when no other alias exists, etc.
Many thanks.
Naran.
|