SQL-Ledger Homepage

SQL-Ledger User Forum

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

How is the shipto table related to the customer table (General)

posted by JayArr(R) Homepage, Mission BC Canada, 17.05.2016, 16:58

My mistake Greg

The Shipto table has a trans_id number that corresponds to the 'id' number in the ar table.

Yes, my Shipto table is filled with near identical records as well but each record is for a different invoice, don't delete them. This table isn't just a list of addresses, it'll be referred to any time you want to reprint an invoice.

Say you sell to Acme on Monday and ship to Baltimore - add 1 record to shipto table

On Wed you sell again to Acme but you ship to Clevelend - add another record to shipto table.

On Friday you sell to Acme and ship to Dallas - add another record to shipto table.

If the records will all look the same in the shipto table except for the trans_id that relates them to their specific invoice.

If you delete the "duplicates" then when you reprint the invoice from Monday you'll be in trouble, it won't be able to fetch the data on where it was shipped to and may incorrectly say it was sent to head office.


Good afternoon Jeff.

I am looking at the three tables now. I see the trans_id on the shipto
table. I can not see the trans_id on the ar table. I have id,
customer_id, employee_id, department_id, bank_id and payment_id.

The id on the customer record does not always link to the trans_id in the
shipto table. There must be some sort of link I am not seeing, as the
shipto addresses show up when I create a sales order, but unfortunately way
too many shipto records were created most are exactly the same except some
small typo fixed. The question is now how to get rid of all the duplicate
records, and adjust pointers to point at the correct record (the one that
is left after 3 or 4 are deleted).

Does this make any sense?

Hi Greg

I don't know if you figured this out but here's what I came up with.

The Shipto table has a trans_id number that corresponds to the trans_id
number in the ar table,

In the ar table there is a customer_id number that corresponds to id in
customer table and to trans_id in the address table giving you the
and the mailing address.


I have to write a quick query based on the ship to address, to find
the ultimate customer was. My problem is I am having trouble
how the shipto table relates to the customer table. ie: If I have a
child shipto record, how do I know who the parent record is?

Anyone have an idea how this is set up?

Gregory A. West


Complete thread:

Back to the forum
Board view  Mix view
1016 Postings in 337 Threads, 373 registered users, 78 users online (0 registered, 78 guests)
SQL-Ledger User Forum | Admin contact
powered by my little forum