2

I want to replace the value in the perform column that is less than the 5th percentile with 5th percentile. Can I use the following to achieve?

update ljdata set perform=percentile(perform, 5) where perform<percentile(perform, 5)>

I have sample data percentile(perform, 5)=-15.77, but after executing this sentence, all the original values less than -15.77 are replaced by -61.38. How can I correct it? Thank you in advance for any help!

FFF
  • 147
  • 1
  • 8

1 Answers1

0

You can try the following code:

p5=exec percentile(perform, 5) from ljdata
update ljdata set perform=p5 where perform <p5

The problem is that where statement is executed before update. When the percentile is calculated, it is not the original data, but the remaining data involved in calculation.

Shena
  • 341
  • 1
  • 5