sql - Get the row at 60% of the table -


i'd select row @ 60% of table oracle. can find number of 60% row with:

select round(count(*)*0.60) sira      (select to_date(time) tarih,lenght hiz  table order length desc) 

i'm looking name column data row @ 60%. is, 60% of rows should have higher length selected row.

for example, data:

name   time    length r1     10:00   1 r2     10:02   2 r3     10:04   3 ... r10    10:20   10 

i'm looking query prints r4 (row @ 60% ordered decreasing length.)

select  *    (         select  row_number() on (order yt.length desc) rn         ,       count(*) on () cnt         ,       yt.*            yourtable yt         ) subqueryalias   rn = round(cnt * 0.60) 

example @ sql fiddle.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -