AnsweredAssumed Answered

Q about proper relations

Question asked by AntonChuykin on Jan 23, 2012
Latest reply on Jan 26, 2012 by AntonChuykin

Title

Q about proper relations

Post

Hi there!

Please try to explain me about relations between tables. I have a situation:

Order confirmation DB with fields of customer and delivery place, both are companies. Let's say delivery place is a customer of my customer.

So, I have 3 tables:

Invoice.table with id.invoice (serial), customer.invoice, delivery.invoice fields (many more, but don't worth mentioning)

Customer.table with id.customer (serial), name.customer, address.customer

Delivery.table with id.delivery (serial), name.delivery, address.delivery

By default, I set delivery.invoice to lookup from customer.invoice (in my Invoice.table) as in 80% cases they match, but sometimes I need to add new delivery place. So, there is dropdown list that use autocomplete to fill delivery place. 

How should I set my relations between this three tables?

Ah! There is one more thing. Sometimes my delivery place becomes my customer, so I just need a small button and a script that will set new record in custome.table copying info from delivery.table. But i don't think i need relations for script. 

Thank you for all your help

Outcomes