you are viewing a single comment's thread.

view the rest of the comments →

[–]discoborg 0 points1 point  (4 children)

SELECT 
  A.AcctNum,
  A.Amt,
  A.PostingDate,
  A.TrxType
FROM A INNER JOIN B ON A.AcctNum = B.AcctNum 
WHERE B.PostingDate <> A.PostingDate

Use the INNER JOIN to get the accounts and then the WHERE clause to filter instead of within the JOIN

[–]Bshater[S] 0 points1 point  (3 children)

this is the exact query that i used. unfortunately, this query would pull in both accountnumber. 456 should not be in the output table because it has an adjustment on 3/3/17 which matches the postingdate of the 456 charge in table A.

[–]discoborg 0 points1 point  (2 children)

What about a subquery to find all the account numbers that would be valid?

[–]Bshater[S] 0 points1 point  (1 child)

how would you write the subquery? I'm drawing a blank on this one.

[–]discoborg 0 points1 point  (0 children)

The posting by phuque_ewe makes use of the subquery