Convert single value into multiple lines
i'm converting a database.
i have to convert a single column value (ie "bedrooms": 3) into multiple lines into another tablebe开发者_Go百科droom | 1
bedroom | 1
bedroom | 1
i'm using MS-Access to convert everything into a MySQL db, how can i do that?
Assuming you have a finite number of plural nouns, just write some VBA to use brute force.
pseudo code:
// suppose roomcount == bedrooms:3
room = whateverisbeforecolon (roomcount); // bedrooms
count = whateverisaftercolon (roomcount); // 3
if room = "bedrooms" then
begin
for i = 1 to count do
DoSomeSQL('insert into floorplan (listingnumber,roomtype,qty) values('1234','bedroom','1')');
end;
精彩评论