select c.article, g.quantity
from smcard c left join smgoods g on (c.article = g.article)
where c.article in ('169847', '000002');
ARTICLE QUANTITY
000002 0,000
169847
select c.article, ost.quanto
from smcard c left join (SELECT ost.ARTICLE, sum (OST.QUANTITY) quanto from supermag.SMGOODS ost GROUP BY ost.ARTICLE ) ost on (ost.ARTICLE=C.ARTICLE and OST.QUANTO=0 /*or OST.QUANTO=NULL*/)
where c.article in ('169847', '000002');
ARTICLE QUANTO
000002 0
169847
select c.article, g.quantity
from smcard c left join smgoods g on (c.article = g.article)
where c.article in ('169847', '000002');
ARTICLE QUANTITY
000002 0,000
169847
select c.article, ost.quanto
from smcard c left join (SELECT ost.ARTICLE, sum (OST.QUANTITY) quanto from supermag.SMGOODS ost GROUP BY ost.ARTICLE ) ost on (ost.ARTICLE=C.ARTICLE and OST.QUANTO=0 /*or OST.QUANTO=NULL*/)
where c.article in ('169847', '000002');
ARTICLE QUANTO
000002 0
169847
select c.article, g.quantity
from smcard c left join smgoods g on (c.article = g.article)
where c.article in ('169847', '000002');
ARTICLE QUANTITY
000002 0,000
169847
select c.article, ost.quanto
from smcard c left join (SELECT ost.ARTICLE, sum (OST.QUANTITY) quanto from supermag.SMGOODS ost GROUP BY ost.ARTICLE ) ost on (ost.ARTICLE=C.ARTICLE and OST.QUANTO=0 /*or OST.QUANTO=NULL*/)
where c.article in ('169847', '000002');
ARTICLE QUANTO
000002 0
169847
string sSQL =
SqlFormat(select
c.ARTICLE, c.name from
supermag.smcard c left join (SELECT ost.ARTICLE, sum (OST.QUANTITY) quanto from supermag.SMGOODS ost GROUP BY ost.ARTICLE ) ost on (ost.ARTICLE=c.ARTICLE and OST.QUANTO=0)
LEFT JOIN (SELECT logi.article FROM supermag.SMCARDSECURITYLOG
logi where logi.ACTIONCODE = 1
and logi.EVENTTIME between (+RepSqlText.ToSqlDate(sLastDate)+) and +RepSqlText.ToSqlDate(sFirstDate)+
) n on (n.article=c.article)
LEFT JOIN (SELECT reps.article from supermag.FFMAPREP reps
where reps.saletype NOT IN ('WI', 'WO', 'IW', 'CS', 'CR', 'PO', 'PN', 'PE')
)reps on (reps.ARTICLE=c.ARTICLE)
where c.ACCEPTED=1
and n.article is null
and reps.article is null
GROUP BY c.ARTICLE, c.Name
);