On Mon, 2006-06-05 at 17:57 +0200, Alex du Plessis wrote:
> 
> -------- 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.

Ah, I bet that the problem is the 'AS total' statement. I think that
SQLDB ignores that, and comes up with it's own name. Do a 'for count :=
1 to fields.count-1 do writeln(fields[count].name);'

That'll clarify a few things.

Joost.


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

Reply via email to