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 |
What is hot add cpu in sql server 2008?
How does index makes search faster?
What is the STUFF function and how does it differ from the REPLACE function?
where do you use Isolations?give me some exmpale?
What are security principals used in sql server 2005?
What will be the maximum number of indexes per table?
table:employee EID ENAME MID(manager ids) 101 rama null 102 sita 101 103 siva 101 104 ganesh 103 . . . . . . for 103 ID the manager ID is 101(RAMA) and for 104 manager is SIVA if i give employee id (EID) you have to tell the manager for that EID write query? eample:if i give 102 .The query output should be manager for 102 ID that it should print RAMA as output
How do you test your database? : sql server database administration
What is use of @@ spid in sql server?
How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
Explain in brief how sql server enhances scalability of the database system?
diffrence between function and procedure