What about a master table like:

Order ID | Ship_TO | BILL_TO

Then an address table:

Then you could have many addresses, and IFFthe Bill to and Ship to were the same
then the master table would reflect that.  Many sites provide a check box to
indicate that the Bill to and Ship to are the same, which you would key off of
and if so, assign the same Unique Address ID to both fields in the master
table.  Many ways to do this, but those are my thoughts....


"1LT John W. Holmes" wrote:

> > >Hopefully the other solution worked for how to parse the data. If not,
> post
> > >back. What I wanted to comment on is why would you use two tables, one
> for
> > >SHIP_TO and one for BILL_TO? Why not just add a column to one table set
> set
> > >it to BILL or SHIP. You won't be repeating data that way and it'll be
> easier
> > >to find things overall. Plus you can just have a column that flags
> whether
> > >the SHIP_TO and BILL_TO addresses are the same.
> > >
> > >
> >     I haven't gotten that far yet.  BILL_TO and SHIP_TO aren't always
> > the same people, hence my initial thought of creating two tables and
> > keep things separate.  However, you're right, I could dump it all into
> > one table - if they're different, then populate the rest of the fields,
> > if not, don't bother.
> What I was thinking is that you have one table with
> Order_ID
> Name
> Address
> Flag -> Here you flag this as SHIP_TO or BILL_TO
> etc...
> Your order_ID could be a key, but it will not be unique, since if the
> bill_to and ship_to address are different, the order_id will appear in the
> table twice. So an order with different shipping and billing addresses would
> have two rows in the table. An order where they are the same would only have
> one row.
> That layout would be better than:
> Order_ID
> Ship_name
> Ship_address
> Bill_name
> Bill_address
> etc...
> Which is what I got from you last email.
> Does anyone agree?
> ---John Holmes...
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to