i currently have a table named my_table, like:
now when i run this query:
SELECT DISTINCT Country,Zipcode,Plan_Id FROM my_table;it's gives me a table without those repeated rows. now i want that output in a new table, how do i do?
11 Answer
You need CREATE TABLE . . SELECT :
CREATE TABLE table
AS SELECT DISTINCT Country, Zipcode, Plan_Id FROM my_table;By this way you will get data into new table. If you already have a new table then use INSERT INTO . . . SELECT instead :
INSERT INTO table (Country, Zipcode, Plan_Id) SELECT DISTINCT Country, Zipcode, Plan_Id FROM my_table;