I have a table that contains 2 fields: ID, ITEMS, as:

CREATE TABLE foo (ID INTEGER PRIMARY KEY, ITEMS);
INSERT INTO foo VALUES(1,item1;item2;item3);
INSERT INTO foo VALUES(2,item1;item4);
INSERT INTO foo VALUES(3,item5;item3;item7);

As shown, ITEMS is comprised of individual data items separated by 
semicolons. For some purposes, this concatenated form suits the purpose, 
but for other purposes I need to split these items into individual data 
points. That is, I want to split the ITEMS (at the semicolons) into 
separate rows in a new table FOO2, having fields ID and SINGLEITEM that 
looks like this:

ID, SINGLEITEM
1,item1
1,item2
1,item3
2,item1
2,item4
3,item5
3,item3
3,item7

Any suggestions of how to do this in SQLite?

Chris Martin
UNC-CH


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to