Subject Re: [IBO] Re:TCDSProvider does not like TIBOQuery
Author Hans
IB_SQL gladly accept and properly calculates:

SELECT SUM(QTY_INITIAL) FROM INVENTORY WHERE QTY_INITIAL <> 0

No UniqueKey or and indexed field used, shown plan:

PLAN (INVENTORY NATURAL)

----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <IBObjects@yahoogroups.com>
Sent: Saturday, August 14, 2010 10:20 PM
Subject: Re: [IBO] Re:TCDSProvider does not like TIBOQuery


> At 12:41 PM 15/08/2010, you wrote:
>>Hi Helen,
>>This is typo error on my email, however my TIBOQuery is correct, as
>>follow.
>>
>>Select sum(amount) Tamt from SaleRevenue
>>where region = 'West'
>>
>>
>>Problem: TIBOQuery looking for the primary key
>>that is not listed in the select clause
>
> It's looking for a unique key, not necessarily the Primary key. A set
> with only one non-unique field is no use to a client application.
>
> Try
>
> select sls_id, sum (amount)
> from SaleRevenue
> Where region = 'West'
> group by 1
>
> and set the KeyLinks property explicitly to sls_id
>
> Note that this is NOT an updatable set so it's possible that the
> TCDSProvider is set to read-write and is complaining because it cannot
> establish a key field on which to base a searched update.
>
> HB
>
>
>
> ------------------------------------
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
> papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>