Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-08-31 : 10:32:50
|
ram writes "How do u derive the row no 'n' from a result of a query given a random query ,a random column and a random value using a fn OR a spRandom query might have an order by clauseSay the output of the random input query on a table results into a record set belowcol1 col2 col3 ----------------a a1 a2b b1 b2c c1 c2 and if random inputs --> colinput = col2 and colvalinput = b1 are providedthen the output of the fn should be 2 --indicating the position on the row where value b1 is ." |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-01 : 17:58:58
|
[code]-- prepare test datadeclare @test table (col1 varchar(2), col2 varchar(2), col3 varchar(2))insert @testselect 'a', 'a1', 'a2' union allselect 'b', 'b1', 'b2' union allselect 'c', 'c1', 'c2'-- show the row for b1 value in col2select count(*)from @testwhere col2 <= 'b1'[/code]Peter LarssonHelsingborg, Sweden |
|
|
|
|
|