Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 2 of 2 total |
slow query? |
Wed, Jan 16 2008 10:21 AM | Permanent Link |
Andrej | What is wrong with this query? Clasic master/detail with 3000/8000 records I wait for the
result 5 minutes?! D6, dbIsam 4.25, both tables have same index with key (dokument;stevilka;poslovalnica;leto) please advise select sum(p.kolicina * (1 - p.rabat/100)*p.pc) as mpvrednost, sum(if(p.ddv = 20 then p.kolicina * (1 - p.rabat/100)*p.pc*p.ddv/(p.ddv+100) else cast(0 as Float)) )as vrednostddv20, sum(if(p.ddv = 8.5 then p.kolicina * (1 - p.rabat/100)*p.pc*p.ddv/(p.ddv+100) else cast(0 as Float)) ) as vrednostddv85, sum(if(p.ddv = 20 then p.kolicina * (1 - p.rabat/100)*p.pc/(1 + p.ddv/100) else cast(0 as Float)) ) as osnova20, sum(if(p.ddv = 8.5 then p.kolicina * (1 - p.rabat/100)*p.pc/(1 + p.ddv/100) else cast(0 as Float)) ) as osnova85, sum(p.kolicina * (((1 - p.rabat/100)*p.pc/(1 + p.ddv/100))-p.cena)) as marza, sum(p.kolicina * p.cena) as nabavna, sum(p.kolicina) as komadi, sum(p.kolicina*(p.rabat/100)*p.pc) as rabati, cast(d.datum as char(20)) as opis, d.datum from pozicije p, dokumenti d where p.dokument = d.dokument and p.stevilka = d.stevilka and p.poslovalnica = d.poslovalnica and p.leto = d.leto and p.poslovalnica = d.poslovalnica and d.dokument = 'MP' group by d.datum order by d.datum |
Wed, Jan 16 2008 1:02 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |