First I must apologise for the dreadful formatting. I didn't realise my columns were broken when I copied and pasted the text until the message had been saved and I could not edit the post afterwards.
> The ItemData ID can be looked up with a correlated subquery: > > INSERT INTO ItemHistory( > Boughton, Quantity, Aisle, Price, Discount, Total, ItemDataId) > SELECT boughton, quantity, aisle, price, discount, total, > (SELECT Record > FROM ItemData > WHERE Itemname = ShoppingHistory.item > AND Category = ShoppingHistory.category > AND Brandname = ShoppingHistory.brand > AND Manufacturer = ShoppingHistory.manufacturer) > FROM ShoppingHistory; This last bit is amazing Clemens. I would never have figured it out. Very much behind the eight ball on more complex queries. I now have nicely split table with 5,475 grocery items in one table with buying history and around 2,120 items with no history associated. Years of online grocery shopping allowed me to collect this data. None have UPC barcodes though, as I had to get the data from emails (Which didn't contain them). (That's the next job.) Thank you so very much. > > Regards, > Clemens > _______________________________________________ > sqlite-users mailing list > [hidden email] </user/SendEmail.jtp?type=node&node=70802&i=0> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > ------------------------------------------------------------------------ > If you reply to this email, your message will be added to the > discussion below: > http://sqlite.1065341.n5.nabble.com/Splitting-a-monolithic-table-into-two-related-ones-tp70776p70802.html > > > To unsubscribe from Splitting a monolithic table into two related > ones., click here > <http://sqlite.1065341.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=70776&code=Z2FyeS5mbGFraGVhcnRAZ21haWwuY29tfDcwNzc2fDExMjQwMDUzNzg=>. > NAML > <http://sqlite.1065341.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > > -- View this message in context: http://sqlite.1065341.n5.nabble.com/Splitting-a-monolithic-table-into-two-related-ones-tp70776p70807.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

