November 12, 2019 at 4:02 pm
Hi
Table 1
AccountId Name
1101 aaaa
1701 bbbb
Table 2
TransIdAccountDebitCreditRefDate Account Id
120300005008-04-20191101
120810302508-04-20191210
166019475008-04-20197101
2203000100003-04-20191701
220810325003-04-20191210
2660212012503-04-20198710
3 203000 0 100 10-04-2019 1101
3 208103 0 50 10-04-2019 1210
3 660194 150 0 10-04-2019 7101
Result
TransIdAccountDebitCreditRefDateAccount Id
120300005008-04-20191101
120810302508-04-20191210
3 203000 0 100 10-04-2019 1101
3 208103 0 50 10-04-2019 1210
220300005008-04-20191701
220810302508-04-20191210
Thanks
Thanks
November 12, 2019 at 4:11 pm
Not sure what the purpose of your topic is here? Could you explain? Are you simply sharing us your data and your final result and want to share how you achieved that? If so, you should include the SQL and explain it; that'll really help other.
Thanks.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 12, 2019 at 4:18 pm
Hi
Actually i want if TransId of AccountId (1101) has record with AccountId 1210 with same TransId as of (1101) then that record should also be displayed.
If we link on AccountId then only 2 rows of 1101 & 1 row of 1701 will be displayed.
Thanks
November 12, 2019 at 4:51 pm
As you have not provided DDL and DML to allow us to use your sample data, I will provide an outline solution only.
SELECT ...
FROM Table2 t2
WHERE t2.TransId in (SELECT TransId from Table1 t1 WHERE t1.AccountId = 1101)
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply