The embodiment of the invention discloses a method and device for merging data tables. According to one specific embodiment, the method comprises the steps of obtaining the configuration information of a merging task, wherein the configuration information comprises a merging mode, a
field mapping relation and identifiers, primary keys and foreign keys of at least two to-be-merged data tables; determining a first table according to the merging mode and the identifiers, the primary keys and the foreign keys of the at least two to-be-merged data tables; taking the first table as a target data table, and executing a merging step: collecting data in the target data table; judging whether the target data table is a
tail table or not; in response to determining that the target data table is a
tail table, storing the collected data in a wide table according to the
field mapping relationship; and in response to determining that the target data table is not the
tail table, determining a new target data table according to the identifier, the
primary key and the
foreign key of the target data table and the identifier, the
primary key and the
foreign key of the uncollected data table, and continuing to execute the merging step. According to the embodiment, the data tables can be flexibly merged, and the merging efficiency is improved.