ok i have some sql and i am trying to show all 'people' in my database, the problem arises because i am joing an 'areas' table which has a one to many relationship with my 'people'(in this case tradesmen and the areas is the areas that they service..)
so i am getting as a result a list of all tradesmen and they are repeated for evey area that they service, how do i fix my joins so that it will show one tradesmenID even if there are multiple areas..
heres my sql:
so i am getting as a result a list of all tradesmen and they are repeated for evey area that they service, how do i fix my joins so that it will show one tradesmenID even if there are multiple areas..
heres my sql:
Code:
SELECT distinct t.tradesmenID, t.businessName, tr.tradeName,t.tradeID, a.areaID
FROM tradesmen t INNER JOIN tradesmenarea a on t.tradesmenID = a.tradesmenID INNER JOIN areas ar on a.areaID = ar.areaID INNER JOIN trades tr ON t.tradeID = tr.tradeID
ORDER BY t.businessName ASC