Posted on: 5/6/2012 6:48:14 AM | Views : 304

Hello
I have Several tables a snapshot of the layout would be
TableOne ------------ PK_PersonID Field_PersonsName Field_Other Field_More
TableTwo ------------ PK_RoomID FK_RoomNameID Other fields
TableThree ------------ PK_RegistrationID FK_RoomID FK_PersonID Other fields
TableFour ------------ PK_PaymentID FK_RegistrationID AmountPaid Other fields
TableFive ------------ PK_RoomNameID FK_RoomName Other fields
Am able to do a query with this SQL Statement
SELECT PK_RegistrationID, FK_RoomID, FK_PersonID, TotalPayment FROM TableThree  INNER JOIN  (SELECT FK_RegistrationID,sum(AmountPaid) as TotalPayment     FROM  TableFour GROUP BY FK_RegistrationID) TableFour ON TableFour.FK_RegistrationID = PK_RegistrationID

My pr ...

Go to the complete details ...