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 ?
Answer Posted / 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 |
Post New Answer View All Answers
What are the benefits of filtered indexes?
Why should we go for stored procedures? Why not direct queries?
How to use copy and concatenate commands in SQL?
Explain forward - only cursors?
Can You Use Data Mining Models In Ssrs?
How do indexes help, types?
How to get a list of columns in a view using the "sp_help" stored procedure?
What are different types of roles provided by ssrs?
What are the disadvantages of using querystrings to send data from one page to another?
What are pessimistic lock and optimistic lock?
Write SQL queries on Self Join and Inner Join.
What are data driven subscriptions?
How are the exceptions handled in sql server programming?
Do you know data definition language, data control language and data manipulation language?
how many triggers you can have on a table? : Sql server database administration