tony_bat wrote: > Here is query that works > select SUM(D_AMOUNT),DN_TYPE > FROM TYPE_DONATION, DONATIONS > WHERE TYPE_DONATION.DONATION_ID IN (SELECT DISTINCT DONATION_ID FROM > DONATIONS WHERE MEM_ID = 4) > and donations.donation_id = type_donation.donation_id > GROUP BY donation_type > > Thanks everyone > Glen you made me put in the join donation_id = donation_id > > Tony
In my experience, subqueries are generally slower (the database engine may decide to run the subquery for every row) and implicit inner joins tend to perform better when they appear _first_ in the WHERE clause. But you don't seem to have any special need for a subquery. This: SELECT SUM(d_amount), dn_type FROM type_donation, donations WHERE donations.donation_id = type_donation.donation_id AND donations.mem_id = 4 GROUP BY donation_type Should do the same thing. Not sure what the difference is between dn_type in the SELECT portion and the donation_type in the GROUP BY portion but they seem like the same thing. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/

