Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 Tags
Subject: RE: enginbehaviour
Thread ID: 288699 Message ID: 288968 # Views: 26 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Projects and Design
Date: Monday, December 27, 2010 12:24:24 PM         
   


> >
> > You shouldn't use GROUP BY when there's no aggregation with any of the functions SUM(), COUNT(), AVG(), MIN() or MAX()
>
>
>
> Why must we use aggregation? Can you explain?
>
select religion,city from employees order by religion,city group by religion,city

> Would I have to use a aggregate function for the query above? Even if I don't need it?
> (Note: above is just a query from top of my head, as a example)
>
>
>
>
> > If there's only one possible wages for a given ecode+month you can use MAX(wages) or MIN(wages), SUM(wages), or AVG(wages(: they will all come to the same.
> > -Anders
>
>
>
> Regards
> Samir



I didn't write that you MUST NOT. I wrote that you SHOULD NOT.
The qustion has been discussed numerous times on the Net. The overwhelming majority of experts are of opinion that you shouldn't use GROUP BY where DISTINCT will do exactly what you want.
-Anders

ENTIRE THREAD

enginbehaviour Posted by vaishali maske @ 12/23/2010 10:09:04 AM
RE: enginbehaviour Posted by Cetin Basoz @ 12/23/2010 10:17:23 AM
RE: enginbehaviour Posted by vaishali maske @ 12/23/2010 10:59:06 AM
RE: enginbehaviour Posted by Anders Altberg @ 12/23/2010 2:56:09 PM
RE: enginbehaviour Posted by Rakesh Kumar @ 12/23/2010 3:39:27 PM
RE: enginbehaviour Posted by Anders Altberg @ 12/24/2010 2:23:32 AM
RE: enginbehaviour Posted by Rakesh Kumar @ 12/25/2010 1:03:31 PM
RE: enginbehaviour Posted by Samir H. @ 12/27/2010 10:19:44 AM
RE: enginbehaviour Posted by Michel Levy @ 12/27/2010 11:34:50 AM
RE: enginbehaviour Posted by Samir H. @ 12/27/2010 12:05:40 PM
RE: enginbehaviour Posted by Michel Levy @ 12/27/2010 12:55:39 PM
RE: enginbehaviour Posted by Cetin Basoz @ 12/27/2010 11:37:58 AM
RE: enginbehaviour Posted by Anders Altberg @ 12/27/2010 12:22:00 PM
RE: enginbehaviour Posted by Anders Altberg @ 12/27/2010 12:24:24 PM
RE: enginbehaviour Posted by Samir H. @ 12/27/2010 1:08:41 PM