Latest

Thursday, July 6, 2017

Migrating old table to new table in laravel

Asked by: SeedCom


I have a problem where i need to migrate old table to new table. The old table data example like this:

Old table(Leave table)

Id   User_id    Reason    Date
1    100          Fever      29/01/2013
2    100          Fever      30/01/2013
3    100          Fever      31/01/2013
4    100          Fever      01/02/2013

New table(Leave table)

Id   User_id    Reason    Start Date   End Date
1    100          Fever      29/01/2013   01/02/2013


Is there any way where i can iterate old table and store like new table.?

29/01/2013 - 01/02/2013 produce 4 rows.. new table need 1 rows which start date and end date which 29/01/2013 be the start date and 01/02/2013 be the end date

new table i already created. i just want to iterate the list of old table and insert it into new table which have start date and end date.



Source

No comments:

Post a Comment

Adbox