I have a query showing me all my stock. But I need to count just the items which appearing more than once in the column. I know I have to use group by and having count >1 statement but I don't know how to fit that into my query.
This is my query:
select
t1.lotnopre, t1.lotno, t2.locbin , t2.locstor , ((t2.locstock+t2.locqrstock)+(t2.locpicked+t2.locconsign))+t2.localloc , t1.lotqty , t1.account15_lot, t2.partno_alt
from livedb.mbc020 t2, livedb.mbc300 t1
where t1.account15_lot = '1 1 5' and t2."account15_alt"=t1."account15_lot" and t2."partno_alt"=t1."partno_lot" and t2."warehouse_alt"=t1."warehouse_lot" and t2."lotnopre_alt"=t1."lotnopre" and t2."lotno_alt"=t1."lotno"
and t1."lotnopre" <> ' '
group by t1.lotnopre, t1.lotno , t2.locbin , t2.locstor , ((t2.locstock+t2.locqrstock)+(t2.locpicked+t2.locconsign))+t2.localloc , t1.lotqty , t1.account15_lot, t2.partno_alt
having count(t1.lotno)>1
order by t1.lotno
The statement don't seems to work. It doesn't show me any information at all. I have tried in many ways fitting this into my query but I am new building the reports and don't really know what I am doing wrong.
I would appreciate any help.