I have two tables in a database. One is the name of a provider (name, general info) the other is the type of provider. The provider can be more than one type. So in my provider database you can choose three different types they would be.
I am having trouble figuring out how to access the provider_type name. I assume a join but can't seem to get past that.
This is what I have now:
SELECT p.name, p.phone, p.provider_type1, p.provider_type2
FROM providers AS p
INNER JOIN provider_type ON p.provider_type1 = provider_type.id
WHERE installation_id = $installation_id
The problem I keep running across is a provider that has more than one type they can be comes up in the query twice, rather I just want to list that provider then underneath list the type of services they can provide.
The join doesn't seem right. All I need to do is grab the provider_type name with the same id as providers.provider_type1 etc..
What should I be doing instead. Thanks.