Convert decimal value to top 10

后端 未结 3 1954
执笔经年
执笔经年 2021-01-27 07:45

I recived some great help earlier today but it was more difficult when I should implement it in my query than I thought. My real query includes several left joins.

I wa

3条回答
  •  遥遥无期
    2021-01-27 08:19

    Assuming that you are trying to rank these values, One possible way of doing this is first determine the min and max values of T3M and T1G, then using something like this:

    SELECT ...,
           ((T3M-@T3M_Min)/(@T3M_Max-@T3M_Min))*9+1 as T3MOutput,
           ((T1G-@T1G_Min)/(@T1G_Max-@T1G_Min))*9+1 as T1GOutput
    

    There may have to be some conversion to an integer value

提交回复
热议问题