How to do Join

  • sql join

    Hello, I am looking for output where

    EG_RequestID = 175998968 and Reissue from paymentID = 333333 from above both temp table.

    I will get multiple reissue payment ID,

    Can you please help me to write query ?

  • But, from what I can see, the Payment_ID column matches to a value 67280309 for Reissued_from_payment_id. How do you related it to 33333 when the payment_id for that is 22222? I think you need to explain some more what it is that you expect to get from the data you have provided. Based just on the information in front of us, I don't see a solution that will be consistent from query to query.

    Are you trying to find the previous reissued_from_payment_id in the ##second table? If so, can we guarantee the ordering of that column will always be what it is in the example (and yes, before anyone tells me, assuming I put an ORDER BY statement in, of course)? If that's what you're looking for, maybe there's a solution, but you need to explain in more detail.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thank you.  Yes, I used created date order by and it works using function last_value.

     

    Thanks

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

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