Skip to content
Advertisement

Can I multiply the output of a SQL query from two separate tables within the same query?

I am taking two values (A, B) from similar but different tables. E.g. A is the count(*) of Table R, but B is a complex calculation based off a slightly adapted table (we can call it S).

So I did this:

Not sure if this was the smartest way to do it (probably was not, I’m a new user).

Now I want to do some multiplications:

  • A*B
  • B-(A*0.75)
  • B-(A*0.8)
  • B-(A*0.85)

etc.

Is there a way to do this within the same query?

Thanks.

Advertisement

Answer

The simplest way,

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement