Subject Re: [ib-support] JOIN the mess
Author Calin Iancu Pirtea
----- Original Message -----
From: "Scott Taylor"
>
> Ultimately, this statement works well:
> SELECT COUNT (*) numhauls, d.TrkID
> , SUM(h.cycletime) CycleTime
> FROM disp_leg d
> JOIN Truck_ID t on d.TrkID = t.TrkID
> JOIN Trk_Hauls h on d.HaulID = h.HaulID
> WHERE d.dumpdate >= '03/01/03'
> AND d.dumpdate <= '03/03/03'
> AND d.complete = 'Y'
> AND d.TrkID >= '1'
> AND d.TrkID <= '20'
> GROUP BY d.TrkID
>
> This gives me everything I need, except the t.leaseopid, when I add it to
> the list I get back to that error message again.
>
Off course. You cannot add a field without adding it to broup clause too.
If you need that info and are sure that is identical for all TrkID then
simply use min(t.leaseopid) and off you go.

If it is not identical you have to add it to group by clause.

Ciao,

Best regards,
Application Developer
Calin Iancu, Pirtea
S.C. SoftScape S.R.L.
pcalin@...