Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are the benefits of filtered indexes?

977


Why should we go for stored procedures? Why not direct queries?

1029


How to use copy and concatenate commands in SQL?

1067


Explain forward - only cursors?

986


Can You Use Data Mining Models In Ssrs?

139


How do indexes help, types?

911


How to get a list of columns in a view using the "sp_help" stored procedure?

991


What are different types of roles provided by ssrs?

144


What are the disadvantages of using querystrings to send data from one page to another?

933


What are pessimistic lock and optimistic lock?

1000


Write SQL queries on Self Join and Inner Join.

1072


What are data driven subscriptions?

106


How are the exceptions handled in sql server programming?

999


Do you know data definition language, data control language and data manipulation language?

988


how many triggers you can have on a table? : Sql server database administration

907