Query

  • 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

  • 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

  • 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

    • This reply was modified 4 years, 5 months ago by  jsshivalik.
  • 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)

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply