|
From: Phil D. <we...@pa...> - 2006-10-28 03:07:16
|
st...@se... wrote: > In SelectSalesOrder and elsewhere Group By like this I believe to be > unnecessary... > > GROUP BY salesorders.orderno, > salesorders.customerref, > salesorders.orddate, > salesorders.deliverydate, > salesorders.deliverto > > In fact I doubt these need to be there either > debtorsmaster.name, > custbranch.brname, > since they are directly linked on a one to one with salesorders and each > other anyway and nothing is being summed within them. > > The bottom line here is orderno. There will only be one debtor name, one > branch name, one customerref, one orddate, one delivery date and one > deliverto per orderno. I believe those extra groupings will do nothing at > the least and could very well slow down the query. They definitely > complicate and confuse. Unless I am misunderstanding something... > > Steve > > > You are right in that mysql does not require to group on all fields - but we are summing at least one field and therefore all the other lines that are not summed must be in the group by for ansi sql - certainly pg requires all fields output to be either an aggregate function going on or grouped by. Phil |