Yaksh Patel
Yaksh Patel

Reputation: 11

Access unmatch query

I am trying to do an unmatch query in access: In Table 1 I have three columns

ID            q ID       Amt

1234411       999        5.00

1234411       996        -10.00

1234411       998        6.00

In the Table 2 I have two columns

ID                    amt

1234411              1.00

I need to make a query where it would look for an unmatch query by subtotaling the amt in Table 1 for similar ID number and compare it to Table 2. There would be multiple different ID in Table 1 and Table 2 with different amounts.

Optional Information: What have you tried so far?: I have tried the simple unmatch query in Access but that does not work for this

Upvotes: 1

Views: 112

Answers (1)

Linger
Linger

Reputation: 15058

SELECT T1.ID, Sum(T1.Amt) AS SumAmt 
FROM Table1 AS T1 
WHERE Sum(T1.Amt) <> 
  (
    SELECT SUM(t2.amt) 
    FROM Table2 AS T2 
    WHERE T1.ID = T2.ID
  )
GROUP BY T1.ID

Upvotes: 1

Related Questions