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 |
Which is the latest version of sql server and when it is released?
How to write a query with a right outer join in ms sql server?
How to delete exactly duplicate records from a table?
What are functions
Can a synonym name of a table be used instead of a table name in a select statement?
How many types of stored procedures are there in sql server?
Can sql servers link to other servers?
Explain use of expression builder.
What is user defined datatypes and when you should go for them?
What are the different types of stored procedures?
What is system stored procedures?
what is the difference detween pairwise comparison subquary and non pairwise comparison subquary?
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)