Hagen Schl�mer wrote:

> SELECT a.IDMandant,a.PRIMANOTA, a.dtmPeriode, a.dtmBDatum, 
> d.IDKTO, e.IDKTO
> AS IDKTOG, a.IDKonto, a.IDKontoG, a.intSSC, sum(a.lngSoll) as 
> slngSoll,
> sum(a.lngHaben) as slngHaben, a.strBelegNr, a.IDM, a.strBuchungsText
> 
> FROM refKonten d,tblBuchungen a,refKonten e
> 
> where
> (d.IDKonto = a.IDKontoG and a.IDKonto = e.IDKonto) and
> (a.IDKonto = 103) Or (a.IDKontoG = 103) and
> ((a.dtmPeriode >=01-03-2003 And a.dtmPeriode < 01-04-2003)) and
> (a.IDMandant=1)
>  GROUP BY a.IDMandant,a.PRIMANOTA, a.dtmPeriode, a.dtmBDatum, d.IDKTO,
> e.IDKTO, a.IDKonto, a.IDKontoG, a.intSSC, a.strBelegNr, a.IDM,
> a.strBuchungsText
> ORDER BY a.PRIMANOTA
> 
> fails with the same error. I've understand, that HAVING is 
> filterig the
> ready resultset, and most of data is then useless. But the 
> error occurs also
> without having clause.

Try it with 

  create index refKonten_i1 on refKonten (IDKonto)
  create index tblBuchungen_i1 on tblBuchungen (IDMandant, dtmPeriode)

and 

  update stat refKonten 
  update stat tblBuchungen 
  update stat refKonten 

This should speed up your statement because of better join transition 
and actual optimizer statistics.

For more information about SAP DB optimizer have a look into
http://www.sapdb.org/7.4/htmhelp/fb/36fe3b34334a7be10000000a114084/frameset.htm

Best regards,
Holger
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to