I´m not sure if i understood clearly.

If you want to list the area and all of companies near it, you could do it:

select
    a.AreaName as Area,
    group_concat(c.CompanyName) as Companys
from
    AreaCompanys a_c,
    Area a,
    Company c
where
    a_c.AreaID=a.AreaID and
    a_c.CompanyID=c.CompanyID
group by a.AreaName
order by a.AreaName;

I hope it works.


""Neil Tompkins"" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]


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

Thanks for any help
Neil
_________________________________________________________________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to