January 2, 201412 yr Newbies 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
January 2, 201412 yr 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?
January 3, 201412 yr Author Newbies 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!
January 3, 201412 yr 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.
Create an account or sign in to comment