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: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com [mailto: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com]On Behalf
Of iqbal_delphidev
Sent: Sunday, 30 March 2008 4:35 PM
To: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com
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 __________
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 delphi-en%40yahoogroups.com">delphi-enyahoogroups.com, "Glen Thompson" <gthomps5...>
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: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com [mailto: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com] On Behalf
> Of iqbal_delphidev
> Sent: Sunday, 30 March 2008 4:35 PM
> To: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com
> 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]
>