How does works "group by" correct

Halldor Gislason halldorg at vortex.is
Thu Aug 12 21:49:45 CDT 2004


"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
>



More information about the Valentina mailing list