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 |
Do you know concepts and capabilities of sql server?
hi ..i am working as a sql dba.....now i want to learn more about t-sql..... is it possible to learn online.... plz refer any site ..thankq
What is filtered index?
How can I check if a view exists in a sql server database?
Explain trigger and trigger types?
Define outer join?
What is row_number function?
can an automatic recovery be initiated by a user? : Sql server administration
Explain “not null constraint” in sql server?
What are the different normalization forms?
Why do we need different type of parameter?
What is the purpose of optimization?
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)