How does works "group by" correct

SoftIl softil at onlinehome.de
Mon Aug 16 12:38:52 CDT 2004


Hallo Halldor, 
thanks for your answer. 
Now I understand where my mistake was. 
I didn't know that I can use goup by only with an aggregate function. 
Now it is clear, why it could not work. 

Thanks
Carsten


----- Original Message ----- 
From: "Halldor Gislason" <halldorg at vortex.is>
To: "Valentina Developers" <valentina at lists.macserve.net>
Sent: Thursday, August 12, 2004 11:49 PM
Subject: Re: How does works "group by" correct


> "select *" returns all the fields so a group by does not really have a 
> purpose there.
> 
> the purpose of the group by is to group the results of some aggregate 
> function by some fields so a group by without such a function has 
> little point
> 
> you may instead be looking for the UNIQUE statement that will not 
> return records with duplicate values of of the field values you specify 
> as unique - I do not know how well Valentina supports UNIQUE
> 
> to group by more than one field simply do:
> 
> select a,b, count(*) from c group by a,b
> 
> or
> 
> select a,b, sum(c) from d group by a,b
> 
> h
> 
> 
> 
> On Aug 12, 2004, at 9:34 PM, SoftIl wrote:
> 
> > Hi all,
> > I've got some problems with "group by":
> >
> > 1)
> > If I try this:
> > select * from myTable group by date
> > the "group by" statement hasn't an effect.
> >
> > If I write this
> > select *,count(any column) from myTable group by date
> > it works correct.
> >
> > Why is it so? In no documentation I could find this, that I have to use
> > "count()" if I'd like to use "group by".
> >
> > 2)
> > How can I use "group by" for more than one column?
> > This statement works not correct. I get all records return:
> > select *,count(any column) from myTable group by date,ohrnummer
> >
> > Thanks for your help.
> > Carsten
> >
> >
> > _______________________________________________
> > Valentina mailing list
> > Valentina at lists.macserve.net
> > http://lists.macserve.net/mailman/listinfo/valentina
> >
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 



More information about the Valentina mailing list