Subject RE: [firebird-support] Re: group by or distinct
Author Alan McDonald
> > > hello,
> > >
> > > what is faster in such case:
> > >
> > > select
> > > field1, field2, field3
> > > from
> > > table1
> > > group by
> > > field1, field2, field3;
> > >
> > > or
> > >
> > > select distinct
> > > field1, field2, field3
> > > from
> > > table1;
> > >
> > > CUIN Kaczy
> >
> > different results for each - which one do you want?
> different?? what do I miss? what is the difference?
>
> > Alan
> CUIN Kaczy

There's no point in grouping by a set of fields unless you are aggregating
an additional field.
select
field1, field2, field3, sum(field4)
from
table1
group by
field1, field2, field3;

what do you want the goup by to return in terms of actual grouping?
Alan