Board index » delphi » Group by problem

Group by problem


2007-02-05 08:01:10 PM
delphi282
Hi,
I need to select this SQL
select
kontr_tipas.pavad tiek_tipas,
kontra{*word*35}.pavad tiekejas,
modeliai.modelis,
(select modeliai_laikai.lbs from modeliai_laikai where
modeliai_laikai.modelis_id = paj2.modelis_id) LBS,
sum(paj2.kiekis) kiekis
from paj2
left join kontra{*word*35} on (kontra{*word*35}.id = paj2.tiekejas_id)
left join kontr_tipas on (kontr_tipas.kodas = kontra{*word*35}.tipas)
left join modeliai on (modeliai.id = paj2.modelis_id)
where paj2.obj_id = 141 and
paj2.dok_data between '2007.02.01' and '2007.02.05'
group by kontr_tipas.pavad, kontra{*word*35}.pavad, modeliai.modelis
order by kontr_tipas.pavad, kontra{*word*35}.pavad, modeliai.modelis
but when I use the sum the group by didn't work, how I can to do this select
without procedure ??? pls help, very thank's
--
Pagarbiai
Darius Evseicikas
==================
UAB "PROGMERA"
Maironio g. 3, LT-60149, Raseiniai
tel./faks. +370 428 70329
mob. +370 699 97390
ICQ 297832308
Informacija šiame pranešime gali būti konfidenciali. Ji skirta tik asmeniui,
kuriam yra adresuota. Jei Jūs nesate tas asmuo (arba atsakingas u?šio
pranešimo pristatym?tam asmeniui), Jūs negalite skaityti, kopijuoti ar bet
kaip platinti šio pranešimo viso ar i?dalies ir skleisti jame esančios
informacijos. Jei šį pranešim?gavote per klaid? prašome informuoti apie
tai siuntėj?ir iškart ištrinti visas šio pranešimo kopijas i?Jūs?
sistemos.
 
 

Re:Group by problem

Every value in the SELECT clause that is not an aggregate (SUM, MIN,
MAX, etc) must appear in the GROUP BY clause.
--
Bill Todd (TeamB)
 

Re:Group by problem

Darius Evseicikas writes:
Quote
but when I use the sum the group by didn't work,
It would help if you mentioned what the problem is.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Please read and follow Borland's rules for the user of their
server: support.borland.com/entry.jspa