how to write the query to select the rows are in the order
of either 1,3,5,7... or 2,4,6,8,...

Answer Posted / leo

with contactinfo as (
select contactid,firstname,row_number() over (order by
firstname)as row from person.contact
)
--select * from contactinfo where row % 2 =0

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the types of indexes.

643


How do I find the port number for sql server?

506


How to execute a sql statement using odbc_exec()?

574


Write an sql query to find first weekday of the month?

489


What are the drawbacks of reporting in ssrs?

108






How does index makes search faster?

607


What is a group function explain with an example?

523


What is model database? : SQL Server Architecture

575


What is indexing in sql server with example?

525


Distinguish between nested subquery and correlated subquery?

553


What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?

522


How can we remove orphan records from a table?

529


How you can minimize the deadlock situation?

557


Explain ranking functions?

612


Write an SQL query to obtain the 2nd highest salary.

614