Division calculation in base

I have a query in Base that produces two columns of numbers. I’d like to create a third column that produces the results of dividing one column by the other column.

Seems like it should be easy, but I’ve not been able to come up with the solution.

Any thoughts or help would be most greatly appreciated.

Thanks,
dm

SELECT ID, N1, N2, (N1/N2) AS RESULT FROM “Table1”

where N1 & N2 are the number columns. Also you may want to consider checking for zeroes as that may cause errors:

SELECT ID, N1, N2, (N1/N2) AS RESULT FROM TESTTABLE where (N1 <> 0) AND (N2 <> 0)

Also:

 SELECT ID, NUMBERFIRST, NUMBERSECOND, (NUMBERFIRST/NUMBERSECOND) AS RESULT FROM (SELECT ID, N1 As NUMBERFIRST, N2 AS NUMBERSECOND FROM TESTTABLE where (N1 <> 0) AND (N2 <> 0))

should work to generate from your existing query (Select from Select).

Thank you once again for your rapid response Mr. R!

Newbie questions – what would be ID and what would be TESTTABLE? Are these the name of the Query?

I got it! Thanks again!!

Don’t need to test N1. Only need to test N2 to avoid division by zero. This should work I think: SELECT ID, N1, N2, (N1/N2) AS RESULT FROM [testtable] WHERE (N2 <> 0)

@EasyTrieve you are absolutely correct. However it is a wasted calculation and generation of a record.