Now I have an excel sheet where you fill out item name, main cat and sub cat and then I save it as an .csv file and the result of the .csv file i shown below.High top 1, Shoes, High topsHigh top 2, Shoes, High topsHigh top 1, Shoes, High topsSandal 1, Shoes, SandalsSandal 2, Shoes, SandalsSandal 3, Shoes, SandalsBoot 1, Shoes, SandalsBoot 2, Shoes, SandalsBoot 3, Shoes, SandalsBS SHIRT 1, SHIRTS, BLACK SHIRTSBS SHIRT 2, SHIRTS, BLACK SHIRTSBS SHIRT 1, SHIRTS, BLACK SHIRTSWS 1, SHIRTS, WHITE SHIRTSWS 2, SHIRTS, WHITE SHIRTSWS 3, SHIRTS, WHITE SHIRTSBRS 1, SHIRTS, BROWN SHIRTSBRS 2, SHIRTS, BROWN SHIRTSBRS 3, SHIRTS, BROWN SHIRTS
After this i import it to my database with this statement:CREATE TABLE custom.items (mi_seq INT PRIMARY KEY NOT NULL DEFAULT AUTOINCREMENT,obj_num varchar (16),item_name (16),main_cat CHAR (25),sub_cat CHAR (25));INPUT INTO custom.items FROM C:\items.csv format ASCII (mi_seq, obj_num, item_name, main_cat, sub_cat);
Result of this in the database:1,,High top 1, Shoes, High tops2,,High top 2, Shoes, High tops3,,High top 1, Shoes, High tops4,,Sandal 1, Shoes, Sandals5,,Sandal 2, Shoes, Sandals6,,Sandal 3, Shoes, Sandals7,,Boot 1, Shoes, Sandals8,,Boot 2, Shoes, Sandals9,,Boot 3, Shoes, Sandals10,,BS SHIRT 1, SHIRTS, BLACK SHIRTS11,,BS SHIRT 2, SHIRTS, BLACK SHIRTS12,,BS SHIRT 1, SHIRTS, BLACK SHIRTS13,,WS 1, SHIRTS, WHITE SHIRTS14,,WS 2, SHIRTS, WHITE SHIRTS15,,WS 3, SHIRTS, WHITE SHIRTS16,,BRS 1, SHIRTS, BROWN SHIRTS17,,BRS 2, SHIRTS, BROWN SHIRTS18,,BRS 3, SHIRTS, BROWN SHIRTS
Now, here is the part that is tricky. I want to use the field obj_num to catagories the database with the main cat and sub cat as shown below. So every main cat starts with 10000 andevery sub cat under main cat starts with 100 as shows in the example. I could do all of thismanually with the code written in previous posts in this tread, but it would take for ever if I have like hundred different sub catExample what I´m trying to accomplish: (These are just examples and don´t exits in the database // Main Header // Main catagory and // Sub Header // Sub catagory)1,10000,*** SHOES ***,, // Main Header // Main catagory2,10100,**HIGH TOPS**,, // Sub Header // Sub catagory3,10101,High top 1, Shoes, High tops4,10102,High top 2, Shoes, High tops5,10103,High top 1, Shoes, High tops6,10200,**SANDALS**,, // Sub Header //7,10201,Sandal 1, Shoes, Sandals8,10202,Sandal 2, Shoes, Sandals9,10203,Sandal 3, Shoes, Sandals10,10300,**BOOTS**,, // Sub Header //11,10301,Boot 1, Shoes, Sandals12,10302,Boot 2, Shoes, Sandals13,10303,Boot 3, Shoes, Sandals14,20000,*** SHIRTS ***,, // Main Header // Main catagory15,20100,**BLACK SHIRTS**,, // Sub Header // Sub catagory16,20101,BS SHIRT 1, SHIRTS, BLACK SHIRTS17,20102,BS SHIRT 2, SHIRTS, BLACK SHIRTS18,20103,BS SHIRT 1, SHIRTS, BLACK SHIRTS19,20200,**WHITE SHIRTS**,, // Sub Header //20,20201,WS 1, SHIRTS, WHITE SHIRTS21,20202,WS 2, SHIRTS, WHITE SHIRTS22,20203,WS 3, SHIRTS, WHITE SHIRTS23,20300,**BROWN SHIRTS**,,// Sub Header //24,20301,BRS 1, SHIRTS, BROWN SHIRTS25,20302,BRS 2, SHIRTS, BROWN SHIRTS26,20303,BRS 3, SHIRTS, BROWN SHIRTS
// Regards