![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Hi! By results of small database competition in one blog was born my question. SA10/SA12 QUERY: select rand() as a from some_table order by a; generate dataset filled by random values, but this resultset not sorted. Tha same query in oracle, postgresql and mysql produce sorted resultset - they win competition. MSSQL even can't generate resultset with one constant random value ![]() Is it possible to get correct sorted by random value resultset from sa? THANKS! |
#4
| |||
| |||
|
|
i have not test but i think you may try to use the derived table method to sort this result set; select rand_col from ( select rand_col = rand() from some_table ) t1 order by rand_sol |
#5
| |||
| |||
|
|
select rand_col*1.0 from ( select rand_col = rand() from some_table ) t1 order by rand_sol |
#6
| |||
| |||
|
|
One more strange result select rand_col*1.0 from ( select rand_col = rand() from some_table ) t1 order by rand_sol produce: rand() as rand_col*1.0 0.59280651928522 0.2991696266919233 0.1439158111549522 0.7930380812813705 0.5910320959943496 0.47643737703395883 |
#7
| |||
| |||
|
|
I have test deruved table method and result bring me a sorrow: rand_col 0.9977807826352216 0.9977807826352216 ... 0.9977807826352216 0.9977807826352216 0.9977807826352216 VERY BAD I am unexpected this result.i have not test but i think you may try to use the derived table method to sort this result set; select rand_col from ( select rand_col = rand() from some_table ) t1 order by rand_sol |
![]() |
| Thread Tools | |
| Display Modes | |
| |