CodeMed
CodeMed

Reputation: 9191

dividing two fields from two different tables

In an MS Access 2010 database, I have two tables which each have a common key. I want to divide the value of a field in one of the tables by the value of a different field in another table. How do I accomplish this in MS Access SQL code?

I want to do this in SQL. There is no graphical user interface.

Here is what I have so far:

SELECT result AS (tblone.DAYS / tbltwo.DIS) 
FROM tblone INNER JOIN tbltwo
ON tblone.NO = tbltwo.NO;  

NOTE: the DAYS and DIS fields are both of data type Double. NO is a Long Integer in both tables.

Upvotes: 0

Views: 8621

Answers (1)

M.Ali
M.Ali

Reputation: 69524

SELECT ROUND((tblone.DAYS / tbltwo.DIS), 2) AS result 
FROM tblone INNER JOIN tbltwo
ON tblone.NO = tbltwo.NO; 

Read here to learn more about the ROUND() Function.

Upvotes: 1

Related Questions