я ошибся мне так и не ясна проблема, с тем почему в моём отчёте записей меньше, чем в стандартном. вот код:
Код:
SELECT c.article as "Артикул",
c.name as "Наименование",
NVL(q.quantity,0)-NVL(pr.quantity,0)+NVL(rs.quantity,0) as "Остаток"
FROM supermag.smcard c,
supermag.smgoods q,
supermag.sacardclass cc,
(
SELECT dc.article,
SUM(dc.quantity) as quantity,
SUM(dc.itemprice) as price
FROM supermag.smdocuments d,
supermag.smspec dc
WHERE d.doctype=dc.doctype
AND d.id=dc.docid
AND d.docstate>=2
AND TO_DATE(d.createdat) >= ('01.07.2007')
AND d.locationto = (2)
GROUP BY dc.article
) pr,
(
SELECT dc.article,
SUM(dc.quantity) as quantity,
SUM(dc.itemprice) as price
FROM supermag.smdocuments d,
supermag.smspec dc
WHERE d.doctype=dc.doctype
AND d.id=dc.docid
AND d.docstate>=2
AND TO_DATE(d.createdat) >= ('01.07.2007')
AND d.locationfrom = (2)
GROUP BY dc.article
) rs
WHERE c.article=pr.article(+)
AND c.article=rs.article(+)
AND c.article=q.article(+)
AND q.storeloc=(2)
AND c.idclass = cc.id(+)
AND cc.tree like '1.1.1.%'
на основе опликованного на этом форуме