how to copy only distinct data into another table which is not already exist in database?
Answers were Sorted based on User's Feedback
Answer / karthik soundararajan
TableA -- Existing Table
ID
5
5
5
5
5
Solution : SELECT DISTINCT ID INTO TableB FROM TableA
It create a table called TableB and insert only one record as shown below:
ID
5
| Is This Answer Correct ? | 3 Yes | 1 No |
SELECT DISTINCT * INTO TABLE_NEW FROM TABLE_EXISTING
| Is This Answer Correct ? | 1 Yes | 0 No |
Is it possible in sql table to have more than one foreign key?
How to Install SQL SERVER 2005 remotely?
How to get the definition of a stored procedure back?
how to insert the values in 5 table at a time Using any single statement ?
6 Answers Infosys, Value Labs,
WHY CAN WE CREATE ONLY ONE CLUSTERED INDEX ON A TABLE IN SQL SERVER?
What are Magic Table?
34 Answers 3i Infotech, Digiweb, Evalueserve, NIIT, PL,
what is the main difference between after trigger and instead trigger.
What do you mean by data integrity?
Difference between rowid and rownum in SQL?
Which tcp/ip port does sql server run on? How can it be changed?
What are the results of running this script?
When would you use sql joins?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)