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 |
What triggers long term care?
What are the different types of collation sensitivity in sql server?
What is sql language?
How many types of database relationship in sql server?
Explain the dirty pages?
To which devices can a backup be created and where should these devices be located? : sql server management studio
In which format does an image save in SQL Server database ?
How to call a function from a stored procedure in SQL Server ?
As per your opinion what are the five top responsibilities of a dba? : sql server database administration
What are various ways to enhance the ssrs report?
Can you explain different types of locks in sql server?
sql server has its default date format in da form "yy-mm-dd" its possible to convert da current date format of sql server to desired format. Now my question is dat how to get da previous and comin days date in my desired format??
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)