开发者

link user account to multiple billing entities

I have a table with user info and a column call CompanyBillingID which links this account to a billing entity in another table. I would like to modify this to have this user account be able to link to multiple billing entities. Looking for a push in the right direction on how to do this. Current SQL statement looks like this:

INSERT INTO EmailContacts (Name, 
                           Email, 
                           Password, 
                           Pull, 
                           StatsAccess,
                           ModifyWebAccess,
                           CompanyBillingID, 
                           Company,
                           BillingContact) 
VALUES ('#newname#', '#form.email#', '#form.password#', #form.pull#,#form.statsaccess#, #form.modifywebaccess#,#form.billingcomp开发者_如何学Goanyid#,'#form.company#',#form.billingcontact#) 

Any help is appreciated. Thank you. -CK


Do you want a one-to-many? One customer can have multiple billing entries? Then add a CustomerID column in your billing table, and link each billing entry to one customer.

Do you want many customers to be able to hook to many company ids (many-to-many)? In other words, should two customers be able to have the same billing id? Then you need to follow Gian's advice, and put a join table in the middle.


If I understand the question correctly, you could create a third table that links users to billing entries, and then there can be as many of these associations as you like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜