e13639
23rd July 2003, 13:14
Hi,

I'd like to do a query using group by, but the compiler gives me an error. Does anybody know how to do that?

Example:

select tisfc030.cwoc, sum(tisfc030.qrjc):tot.qrjc, tiitm001.ctyp
from tisfc030, tiitm001
where tisfc030._index1 inrange {tctror.prd, :pdno.f }
and {tctror.prd, :pdno.t }
and tisfc030.cwoc inrange :cwoc.f and :cwoc.t
and tisfc030.item inrange :item.f and :item.t
and tiitm001.ctyp inrange :ctyp.f and :ctyp.t
and tisfc030.item refers to tiitm001
group by tisfc030.cwoc
selectdo

End of example

The compiler problem is that field tiitm001.ctyp is not included in the group by. I am only interested in group by tisfc030.cwoc and select records where tiitm001.ctyp is in range. Any idea?

e13639
23rd July 2003, 13:49
I've got the solution by myself, sorry. I shouldn't include in the select clause the field tiitm001.ctyp, so:

select tisfc030.cwoc, sum(tisfc030.qrjc):tot.qrjc
from tisfc030, tiitm001
where....

NPRao
23rd July 2003, 20:15
Checking your code-

and tisfc030.item refers to tiitm001


Refer to the thread -

B50c: Error: Degree Mismatch in reference predicate.... (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=9223&highlight=degree) for more info.