List Info

Thread: RE: Re: SQL PROBLEM




RE: Re: SQL PROBLEM
user name
2008-03-30 06:17:50

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]

__._,_.___
.

__,_._,___
Re: resolved SQL PROBLEM
user name
2008-03-30 06:43:01

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&quot; <gthomps5...>
wrote:
>
&gt; 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.
&gt; Glen
>;
> -----Original Message-----
> From: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com [mailto: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com]
On Behalf
&gt; Of iqbal_delphidev
>; Sent: Sunday, 30 March 2008 4:35 PM
> To: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com
&gt; 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
&gt;
> thanks
&gt;
>
>
>
>
> __________ 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]
>

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )