MySQL Forums
Forum List  »  Newbie

how else i can write this query
Posted by: sheida
Date: July 12, 2005 11:17AM

My query works. But is there other way to write it?

select Q1.paAmount, Q2.pAmount
From
(select sum(pa.amount) paAmount,pa.BookingID paBookingid from package_acct pa, Groups g , Person_Group pg where pa.PersonGroupId=pg.Id and pg.GroupId=g.Id group by pa.BookingID
)Q1
Inner Join
(SELECT sum(p.amount) pAmount, p.BookingID pbookingid FROM `payments` p where p.ispaid=1 group by p.BookingID
)Q2
on Q1.paBookingid=Q2.pBookingID

Options: ReplyQuote


Subject
Written By
Posted
how else i can write this query
July 12, 2005 11:17AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.