Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread stupid noob question Group by
Wed, Jun 14 2006 5:29 PMPermanent Link

Marc Pelletier
Hello,

I have a table, Linelist with the following structure:
  with FieldDefs do
   begin
     Clear;
     Add( 'LineID',             ftAutoInc,       0, false );
     Add( 'LineName',           ftString,       30, false );
     Add( 'Flight',             ftInteger,       0, false );
     Add( 'StartTime',          ftFloat,         0, false );
     Add( 'EndTime',            ftFloat,         0, false );
     Add( 'DVD_Label',          ftString,       10, false );
   end;

It is populated with about 250 records. I am trying to do a very simple
query but for some reason it won't work.

'Select min(starttime), max( endtime ) from Linelist group by Flight'

It cacks with a message stating it was expecting a column name and got
'Flight'. I've tried capitalizing, quoting etc but no luck.

Simple, I know. Please illuminate a poor stupid soul.

cheers

Marc Pelletier
Wed, Jun 14 2006 6:21 PMPermanent Link

Marc Pelletier
Marc Pelletier <marc@stopspam.goldak.ca> wrote in
news:Xns97E29C9F58BF4mmpp1234.dd@64.65.248.118:

> 'Select min(starttime), max( endtime ) from Linelist group by Flight'
>

> 'Select min(starttime), max( endtime ), Flight from Linelist group by
> Flight'

Incredibly, none of the sql primers I consulted mentioned that the group
by field has to be part of the result set. The error message was a bit
misleading, but I can see how it makes sense from the sql engine. It is
looking at the result set and I was thinking of the source.

cheers

Marc Pelletier
Thu, Jun 15 2006 1:36 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Marc,

<< Incredibly, none of the sql primers I consulted mentioned that the group
by field has to be part of the result set. The error message was a bit
misleading, but I can see how it makes sense from the sql engine. It is
looking at the result set and I was thinking of the source. >>

Yes, DBISAM requires that all GROUP BY columns exist in the result set.


--
Tim Young
Elevate Software
www.elevatesoft.com

Image