I am talking about SQL Server 2008. I have table with three nvarchar columns. I want to select first column at Nth row, second column from Mth row, third column from Kth row where M,N,K are not equal one to another.
How to write such a query? Also is it possible to select random row?
You can use a CTE with a
ROW_NUMBER()function to achieve this:You need to replace the
N, M, Kwith actual integer values in this query – or define SQL variables to hold those three values.