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 [email protected], "Glen Thompson" <[EMAIL PROTECTED]> wrote: > > You are not joining your 2 tables. You must either join them or omit the > TYPE_DONATION table if it doesn't need to be there. > Glen > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf > Of iqbal_delphidev > Sent: Sunday, 30 March 2008 4:35 PM > To: [email protected] > Subject: [delphi-en] Re: SQL PROBLEM > > > why you are using 'D_AMOUNT' in GROUP BY clause: > > Try the following: > > select DISTINCT SUM(D_AMOUNT) ,D_TYPE > FROM TYPE_DONATION, DONATIONS > WHERE TYPE_DONATION. DONATION_ ID IN (SELECT DISTINCT DONATION_ID FROM > DONATIONS WHERE MEMID = 4) > GROUP BY D_TYPE > > thanks > > > > > > __________ NOD32 2984 (20080329) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > > [Non-text portions of this message have been removed] >

