Subject | Re: Basic Firebird SQL question |
---|---|
Author | Ali Gökçen |
Post date | 2005-10-08T19:46:17Z |
Ok, i see now.(i hope so)
insert into stock_on_hand(part_id,Warehouse_id)
select p.id, w.id from parts p, warehouses w
it will create all rows for each part for each warehouse.
Regards.
Ali
insert into stock_on_hand(part_id,Warehouse_id)
select p.id, w.id from parts p, warehouses w
it will create all rows for each part for each warehouse.
Regards.
Ali
>so
> I may not have explained this well. The Parts table has 1,000 or
> rows. The warehouses table has 6 rows. What the Stock_on_handtable
> does is to represent the join between these two tables, thatresolves
> the many to many relationship that could occur (ie. Part ABC isfound
> in 3 warehouses, Warehouse 1 has 5 in stock, Warehouse 2 has 3 indescription.
> stock, etc.).
>
> Hence in this example:
>
> Part 'ABC'
>
> Stock_on_hand
> Part ABC
> Warehouse 1
> Qty 5
>
> Stock_on_hand
> Part ABC
> Warehouse 2
> Qty 3
>
> etc.
>
> The Warehouse table is only a table of Warehouse No and
> No Qty data is stored there.
>
> Does this explain it better?
>
> Myles
>