Newbies Sundog Posted January 2, 2014 Newbies Posted January 2, 2014 I have a list of Dogs - each dog has one vet; but each vet could be attached to many different dogs. So I have a join table between the two so that: Dog - dog vet - VetClinic. In the dogs layout for entering I have a portal that should allow the person to pull down a list of vet clinics to choose which one their dog goes to. The choosing of a vet clinic (dog id links to dog idfk in join and vet clinic id links to vet clinic idfk in join) isn't a problem, all the vet clinics are there, but I can't figure out how to make the phone number and address for that vet clinic ONLY show up in the next fields in the portal; I can only get it to display all the phone numbers/addresses for all the vets, not the chosen vet. I don't think I understand conditionals
comment Posted January 2, 2014 Posted January 2, 2014 I don't think I understand your description. If "each dog has one vet". then what is the join table for? It also doesn't fit this part: In the dogs layout for entering I have a portal that should allow the person to pull down a list of vet clinics to choose which one their dog goes to. Again, if each dog has one vet, why does it need to go to multiple clinics? It's also not quite clear what (If any) is the difference between a vet and a clinic. Does one clinic have many vets?
Newbies Sundog Posted January 3, 2014 Author Newbies Posted January 3, 2014 One vet clinic has many vets; I suppose I should have been clearer. I haven't started the vets themselves yet, I'm still trying to figure out how to get the vet clinic, vet clinic phone, and vet clinic address to automatically enter after choosing the name of the vet clinic. Once I figure that out, I'll work on individual vets. I'm still a bit confused about when to use join tables too perhaps Thanks!
comment Posted January 3, 2014 Posted January 3, 2014 One vet clinic has many vets If each dog has one vet, and each vet has one clinic, then you should have three tables arranged as: Clinics -< Vets -< Dogs There are no many-to-many relationships here, hence no need for join tables. In the simplest implementation, you would choose a vet for a dog and the vet's clinic would become related automatically by association. In a slightly more complex one, you could choose the clinic first, then select a vet from the chosen clinic's vets. For this, you would need to add an auxiliary relationship between Dogs and (another occurrence of) the Clinics table.
Recommended Posts
This topic is 3977 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now