Conversion...

For complex topics that regular users would not be interested in. For power users and database administrators.
Post Reply
jamesbob
Posts: 1
Joined: Tue Aug 28, 2007 11:37 pm

Conversion...

Post by jamesbob » Tue Aug 28, 2007 11:47 pm

Hello all,

I am attempting to do a conversion for a Dr. but am having trouble creating the mysql insert statement for the patplan table. What I understand is that PatPlanNum is an incremental primary key, PatNum is the foreign key from the patient table and PlanNum is the foreign key from the insplan table. What I have trouble with is populating PlanNum. PlanNum is the same key for however many patients are insured. I just can't wrap my head around creating a mysql insert query using only the insplan, patient and patplan table.

Thanks for the help in advance,

JamesBob

User avatar
jordansparks
Site Admin
Posts: 5742
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Wed Aug 29, 2007 4:39 pm

Are you saying everyone has the same insurance? Even so, if you look at the insplan table, you will see that you have space for one and only one subscriber id. In other words, if you have 100 people on one insurance "plan", 90 being subscribers and 10 being family members, then you would have 90 insplan rows, and 100 patplan rows linking those 90 plans with the 100 patients.

So you have to insert the plan and remember the primary key. Then use that PlanNum key to create a new insert statement. If you're trying to do it in pure SQL, you'll have to use a variable to remember the plannum when you do the insert. Or you'll have to create a temporary table that pairs patnums and plannums, then pull from that table to create your patplans.
Jordan Sparks, DMD
http://www.opendental.com

Post Reply