Multiply count result by 1/2

61 views Asked by At

I need to multiply the count from cells in a qa table x .5. Essentially,

select count (distinct (individual)) 
from qatable 
where cellcode in ('cell 1', 'cell 2', 'cell 3', 'cell 4', 'cell 5') * .5
Cell 1 is 150,
Cell 2 is 175,
Cell 3 is 200,
Cell 4 is 225,
Cell 5 is 250,

Cells 1-5 = 1000 

I would need to show that the result is 500 (1/2 of cells 1-5)

Any ideas?

1

There are 1 answers

1
Eric Brandt On BEST ANSWER

Unless I'm missing something, you just need to move your math up into the body of your query.

SELECT SUM(<WhateverColumnThoseNumbersAreIn>) * .5
FROM qatable
WHERE cellcode IN (
         'cell 1'
        ,'cell 2'
        ,'cell 3'
        ,'cell 4'
        ,'cell 5'
        );

But I feel as though I'm missing something.