Home > database > A SQL sorting method, come in please, thank you!
A SQL sorting method, come in please, thank you!
Time:11-09
According to the following order priority order 1, all the data is the same as 1.11 2.22 3.33 ~ 9.99 decimal point on the left side of the big priorities 2, two to zero after the decimal 1.00 2.00 3.00 ~ 9.00 decimal point on the left side of the big priorities 3, after the decimal two same 0.11 0.22 0.33 ~ 0.99 decimal point on the right priorities 4, three even number 1.23 2.34 3.45 ~ 7.89 numerical priorities 5, three even number 9.87 8.76 7.65 ~ 3.21 numerical optimization sorting first 6 or above, no accord with the sort of three addition 0.35 1.69==8 6 is equal to 10 to remove 10 from 10 more than 10 modulo amount such as 13 take 3 big priority
The above order from 1 ~ 6 order
The following is a data 3.68 2.69 4.36 0.11 6.00 3.33 4.56 3.78 6.54 7.89 2.22 8.56 4.37 3.21 9.96 8.88 4.65 7.89
Thank you guys help!
CodePudding user response:
You make your own weight calculation function to sort, Assume that the input parameters for d The return value (weights) r for the int type The key is your own decision out of 6 kinds of circumstances, the following calculation for r 1, r=1000 + d * 100 2, r=2000 + d 3, r=3000 + ROUND 100 + (d, 0, 1) * (1 - (d - ROUND (d, 0, 1))) * 100 4, r=4000 + d * 100 5, r=5000 + d * 100 6, r=6000 + three additive (d)