-------- Original Message --------
Subject: Re: [lazarus] SQLDB & postgres
Date: Mon, 5 Jun 2006 11:38:20 -0400
From: Alexandre Leclerc <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

Hi Alex,

(You replied only to my by the way; if this was not your intention,
I'll let you forward this to the mailling list.)

Well, all looks right for me and I would see that as a bug with the
information I have under my eyes. Maybe you can have a look at the
suggestions of Bram.

Regards.

2006/6/5, Alex du Plessis <[EMAIL PROTECTED]>:
I collect the aggregate in a view (i.e. I use postgres to request and
generate the agregate).

Here is the sql statement for the view creation:

CREATE OR REPLACE VIEW vwtestaggregate AS
  SELECT users.isactive, sum(users.active) AS total
    FROM users
   WHERE users.isactive = true
   GROUP BY users.isactive;

Here is my query from lazarus:

count := qWork.FieldByName('total').AsInteger;

and I get the complaint that fieldname total cannot be found.

A couple of months ago I realised the problem with uppercase/lowercase
parsing in postgres and since stuck to a policy of keeping all names in
postgres to lowercase.  Unfortunately - that is not the problem - I checked

Alexandre Leclerc wrote:
> I have no answer for this. This should work. Meanwhile someone picks
> that bug:
> - had you tried to giva a name to you sum by yourself in the sql query
> i.e. "sum(field) as mysum"
> - did you check for any uppercase/lowercase issue.
>
> Best regards.
>
> 2006/6/2, Alex du Plessis <[EMAIL PROTECTED]>:
>> Would anybody know why a sqldb query (TSQLQuery) has a problem reading
>> an aggregate field?  I cannot get the query to read an aggregate field
>> for love or money.  It complanis that it cannot find the fieldname
>> (query.FieldbyName('sum').asInteger) or that the
>> index(query.Fields[i].asInteger) is out of range.
>>
>> The query syntax is correct and i can read the result when running it in
>> PGAdmin.
>>
>> _________________________________________________________________
>>      To unsubscribe: mail [EMAIL PROTECTED] with
>>                 "unsubscribe" as the Subject
>>    archives at http://www.lazarus.freepascal.org/mailarchives
>>
>
>



--
Alexandre Leclerc


_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to