how to select 5 to 7 rows from a table, which contains 10 rows?

Answer Posted / purabi roy(sarkar)

select top 3* from Tablename
where columnname in ( select top 7columnname from table
name order by columnname desc )
and columnname not in( select top 4columnname from
tablename order by columnname desc )
order by columnname desc

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I clean up sql server transaction log?

569


What are the benefits and tasks of object explorer? : sql server management studio

607


What is the command used to check locks in microsoft sql server?

542


Do you know what is difference between index seek vs. Index scan?

519


You want to generate a report that is formatted as a chart. Can you use the report wizard to create such a report?

88






Due to some maintenance being done, the sql server on a failover cluster needs to be brought down. How do you bring the sql server down?

865


Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?

494


Write the syntax for stuff function in an sql server?

533


What is sqlservr.exe - process - sql server (sqlex?press)?

598


What happens to a trigger with multiple affected rows?

528


What is user defined datatypes and when you should go for them?

581


What is the use of sign function?

555


How to set database to be single_user in ms sql server?

563


what is the main function of a query parameter?

111


Is ssrs support other database except ms sql server?

96