SQLite & repeated fields

James Hale james at thehales.id.au
Thu Jan 8 02:53:05 EST 2009

Hi Sarah,

I am not sure why you are thinking of repeating fields (sounds  
Filemaker like.)

Aren't you talking about a many to many table relationship?

A product has a list of items. (a one to many relationship) but an  
item can belong to many products ( a many to many relationship)

This would imply three tables; Product, Product-Item, Item

The Product table has;
	product_name, product_id etc.
The item table just the raw item details;
	name, item_id, qty_on_hand etc
The Product-item table has their relationship (i.e is the repeating  
So in your case this table could have the following fields;
	product ID, Item ID, Number_used

Then each time a product is "made", you would look up the records in  
the Product-item table to get a selection of rows from the Item table.
Step through each row of this selection (of the product_item) and for  
each item deduct the "Number_used" value from the associated record in  
the Item table.

Is this what you had in mind?

James Hale

james at thehales.id.au

Tel: +61 3 9386 2516
Fax: +61 3 9386 1387

More information about the Use-livecode mailing list