Use in select percentage in Firebird

Asked

Viewed 501 times

1

I have the following instruction in Excel:

(100%-2%)*2135,68

I want to make an sql:

Select (100%-2%)*T.valor as TOTAL from tb_teste T

In Firebird I can’t work with %. How can I get around this?

1 answer

0

Use basic math to solve the problem.

100% - 2% = 98%

98% = 98/100 = 0.98

We have that 98% represents 0.98

Just change the query to use this calculation:

SELECT (0.98 * T.valor) as TOTAL
  FROM tb_teste T
  • If I do it in SQL ((100-1.25)/100)*2135.68 in sql will give 2092,9664 and if you do it in 2108,984 calculator. You know how to solve this?

  • Solution "select ((100-1.25)/cast(100 as float))*T.value as TOTAL"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.