select t.totalsum, a.supplierdoc, count(*) from smdocuments t, smwaybillsin a where t.doctype=a.doctype and t.id=a.id and t.createdat between to_date(:DateStart,'DD.MM.YY') and to_date(:DateEnd,'DD.MM.YY') group by t.totalsum, a.supplierdoc having count(*)>1