select crd.name, crd.article, cast((sum(goo.quantity)-sum(nvl(op.salequantity,0))+sum(nvl(op.returnquantity,0))) as float) as quantity
from supermag.smcard crd, supermag.smgoods goo, supermag.smopergoods op
where crd.name like '%с408%'
and crd.article=op.article(+)
and crd.article=goo.article
group by crd.name, crd.article, quantity
4 rows selected in 0.062 seconds
select crd.name, crd.article, cast(sv.quantity as float) as quantity
from supermag.smcard crd, supermag.svgoodswithoper sv
where crd.name like '%с408%'
and crd.article=sv.article
group by crd.name, crd.article, sv.quantity
4 rows selected in 2.138 seconds
with a as (select article, name from supermag.smcard c where c.name like '%с408%') select a.name, a.article, cast(sum(nvl(g.quantity, 0))+sum(nvl(o.quantity, 0)) as float) as quantity from a, supermag.smgoods g, (select op.article, op.locid storeloc, sum(op.returnquantity)-sum(op.salequantity) quantity from supermag.smopergoods op, a where a.article=op.article group by op.article, op.locid ) o where a.article=g.article(+) and g.article=o.article(+) and g.storeloc=o.storeloc(+) group by a.name, a.article;
select decode(accepted, 1, 'Активная', 2, 'Исключенная', 0, 'Новая') as Accepted, crd.name, crd.article, cast(sv.quantity as float) as quantity, wm_concat(barcode) as barcode from supermag.smcard crd, supermag.svgoodswithoper sv, supermag.smstoreunits st where crd.article=sv.article and crd.article=st.article and sv.storeloc in (:Storeloc) and barcode in (:Barcode) and upper(crd.name) like upper('%:name%') and crd.article in (:article) and crd.accepted in(:accept) and sv.quantity <>0 group by crd.accepted, crd.name, crd.article, sv.quantity order by 4 desc