Change value into int

So my question is: I run a SQL Query and my result is:

week   sale sale override sell through(%)
Week-1  42  29            3.94804504619449
Week-2  46  36            3.39242402149418
Week-3  53  44            3.91839149445099
Week-4  44  33            3.53663152826439
Week-5  45  20            4.12465416879239
Week-6  45  24            3.9861284151902
Week-7  47  10            3.93148317015786
Week-8  27  14            4.96932263953541
Week-9  49  18            3.6518835739424
Week-10 56  35            3.54296186103223
Week-11 44  23            3.42675072960917
Week-12 42  28            3.73042394308072

So I want now change sell through(%) into this:

week   sale sale override sell through(%)
Week-1  42  29            39
Week-2  46  36            33
Week-3  53  44            39
Week-4  44  33            35
Week-5  45  20            41
Week-6  45  24            39
Week-7  47  10            39
Week-8  27  14            49
Week-9  49  18            36
Week-10 56  35            35
Week-11 44  23            34
Week-12 42  28            37

Is there a way to change value?

Answer

Based on the data you have shown, it looks like you need to wrap the generation of sell through(%) in FLOOR(10.0 *...) e.g. if your existing query was used as a subquery you could write:

SELECT [week], [sale], [sale override],
       FLOOR(10.0 * [sell through(%)]) AS [sell through(%)]
FROM (
  -- your existing query
) d

Leave a Reply

Your email address will not be published. Required fields are marked *