Q:

SQL Merge two queries and insert a new column for calculus

I have 2 tables, Transactions (attributes of Interest: disponent_id, transaction_id) and Attachments (attributes of Interest: disponent_id, filename).
The main goal is the following: 
I want to group the transactions per each Disponent of the table "Transact" (transactions per disponent) 

The same with the table "Attach" (attachments per disponent) 
After, I want to merge both and insert a new column, which shows the ratio of attachments per transaction (Attachments/Transactions) 
..

(1)
Disponent | Transactions
213456    | 35
...

(2)
Disponent | Attachments
213456    | 70

(3)
Disponent | Transactions | Attachments | Ratio
213456    | 35           | 70          | 2
...

I've tried
SELECT Transact.disponent_id, COUNT(Transact.transaction_id) AS Transactionnumber
FROM Transact
GROUP BY Transact.disponent_id
UNION ALL
SELECT Attach.disponent_id, COUNT(Attach.filename) AS Filenumber
FROM Attach
GROUP BY Attach.disponent_id

But the result is only:
disponent_id | transactionnumber
234576 | 65
...

How can I insert the calculation and the attachment column?

A:

I used your queries within with clause, then used new select statement with inner join.
check it out:
With wth0 as 
(
    SELECT 
      Transact.disponent_id, 
      COUNT(Transact.transaction_id) AS Transactionnumber
    FROM Transact
    GROUP BY Transact.disponent_id
), 
wth1 as 
(
    SELECT Attach.disponent_id, COUNT(Attach.filename) AS Filenumber
    FROM Attach
    GROUP BY Attach.disponent_id
)
SELECT 
  wth0.disponent_id,
  wth0.Transactionnumber,
  wth1.Filenumber,
  wth1.Filenumber / wth0.Transactionnumber as Ratio
from wth0
inner join wth1 
  on wth0.disponent_id = wth1.disponent_id;

