Neil Tompkins wrote:
Hi
I've the following tables
(holds a list of companies)
TableName:Company
CompanyID (int)
CompanyName (varchar)
(holds a list of areas)
TableName:Area
AreaID (int)
AreaName (varchar)
(holds a list of what areas are near to what companies),
TableName:AreaCompanys
CompanyID (int)
AreaID (int)
Nearby (y/n)
For example company1 is listed under area 1 but is nearby to area 2, company2 is listed under area 2 and is nearby to area 3.
Based on this could I obtain a list of areas if I passed area 2 to the query. From the above example I would expect to get back the following :
Area1 Name
Area2 Name
select companyname, areaname from
company c,
areacompanys ac,
area a
where
c.companyid=ac.companyid
and
a.areaid=ac.areaid
and a.areaid='2';
not really that complicated.
the 'nearby' doesn't get included because it doesn't matter (in this
case) whether the company is in the area or just 'nearby' - you just
care what's applicable to area 2.
Or I could be completely misunderstanding ;)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]