sql - xls to mysql with foreign keys -
i've xls file type:
group_name | name my_groupe1 | name1 my_groupe4 | name2 my_groupe2 | name3 my_groupe1 | name4
and database:
users id | id_group | name
and
groups id | name
i export xls data in database. must replace "group_name" id of real record in database.
all group record exist in database.
i've think make webservice prefer export directly.
thx
my recommendation create dynamic sql insert statements in excel based on data. below gave formula d2 , e2.
d2:
="insert group (id,name) values (,'" & b2 & "')"
becomes:
insert group (id,name) values (,'my_group1')
e2:
="insert user (id,name,group) values (,'" & b2 & "'," & a2 & ")"
becomes:
insert user (id,name,group) values (,'my_group1',1)
Comments
Post a Comment