Reputation: 562
I am trying to create a table(ie. test1) as another table(test2). test2 has all records. there are some duplicate records like below:
Now I want to all record of table test2 in table test1 like below (using create command):
Thanks in Advance
Upvotes: 4
Views: 325
Reputation: 9755
With MySQL you probably could try like this:
INSERT INTO test1(id, name, address, mobile, genere)
SELECT id, name, address, mobile, genere
FROM test2
GROUP BY name, address, mobile, genere
or if you want a CREATE
syntax try
CREATE TABLE test1 AS
(SELECT id, name, address, mobile, genere
FROM test2
GROUP BY name, address, mobile, genere)
Upvotes: 5