I have a very large table and would need to split into lots of tables.

The large table has lots of fields of which `Model.ID` gives a number of the product and this is repeated lots of times with other fields used in the row.

I need to create lots of new tables based on the Model ID field and its associated fields in that row need to be kept together. So if `Model.ID` = 1614 then a new table will be created and inserted into that will be all the rows that have that.

Obviously i need code that does them all and the `model.ID` dont go in order and are pretty random.

Could anybody help please, as this is way above what i can do php wise.

can anybody help with this?

You can use a query like

INSERT INTO new_table (modelid, column2, column3) SELECT modelid, column2, column3 FROM main_table WHERE modelid = 1614

You can get the unique model id's

SELECT DISTINCT modelid FROM main_table

Hope this will get you started.

that really does help thank you very much