I have a table emp , Fields with empname,dnname,dno,salary.
now I want copy distinct salary with all emp detail from emp into new table which is not already exist in database. how would I do this ?
Answers were Sorted based on User's Feedback
Answer / prashant
SELECT DISTINCT empname,dnname,dno,salary into New Table
from emp
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / b.kumar
WITH CTE
AS
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY SAL ORDER BY SAL) AS ROWID
FROM EMP7
) SELECT * INTO EMP10 FROM CTE WHERE ROWID=1
Is This Answer Correct ? | 1 Yes | 0 No |
Where sql server user names and passwords are stored in sql server? : sql server database administration
explain different types of cursors? : Sql server database administration
What is CTE in SQL
Which table keeps information about stored procedures?
What does the automatic recovery do?
What is the difference between set and select?
How do I create an extended event in sql server?
How to convert a table data in XML format in sql server?
Define indexes?
Define self join?
Write a query to delete duplicate records in SQL SERVER
What is a trigger?