• There is a connection between the two otherwise how does the application work? You seem to be showing the results from the Payments table as the desired output, is that all you want? You need to post DDL and DML and include the related tables I am going to guess there is PatientId involved somewhere

    ...