Muy buenas estoy intentando hacer que un counter se multiplique si el tramaño de un row es igual a x ejemplo:
select art.art_id, histkomm.cnt , count(decode(lhmd.abmz, 600, 2, 1))/*aqui necesito que el counter sea dos, si es el tamaño "x" y uno, si no lo es.*/, sysdate
from lhm, art, sektor,lhmdef lhmd, (select hst.artnr artnr, count(*) cnt
from historie_v hst
where hst.created > sysdate-90
and hst.typ_id =102
and hst.lagnr=13 group by hst.artnr ) histkomm
where histkomm.artnr = art.artnr
and art.art_id = sektor.art_id (+)
and lhm.lhm_id = sektor.lhm_id
and lhm.lhmdef_id = lhmd.lhmdef_id
and lhm.lhmstat=1
and lhm.lag_id=13
and nvl(lhm.auftr_id, 0)=0
group by art.art_id, histkomm.cnt
order by 3 desc;
Por el momento el counter hace su trabajo bien pero no me funciona hacer lo que quiero.
un saludo!
No entiendo muy bien lo que quieres lograr, ¿pretendes que el COUNT cuente como 2 registros si el valor en cierta columna equivale a x? Si es así mejor usas un SUM ¿no? Así te va a sumar lo que sea que te devuelva el DECODE.