I have a situation where my scanners are scanning the same document over and over, and because they get paid per document it is possible they may be doing so purposefully.
I am trying to create a simple report to count the amount of times a document is scanned by a scanner (i.e. group by "createdby")within a specified period, but to also including the date-time the image was created. My issue is that when I include the date-time in the group-by clause it returns no rows. I understand why it does this, but cannot fathom a way to include the date-time of the document in my report. "createdon" is a DATE field which cannot be grouped with the "createdby" and "docid" to give a result set, but I require the createdon value.
Select count(*) as COUNT,
DOCID as DOCUMENT_NUMBER, createdby as username, createdon
from SCOTT.ALL_DOCUMENTS
where SCOTT.ALL_DOCUMENTS.DOC_STATUS = 'SCANNED'
and CREATEDBY like 'domain1\drs%'
and DELETED =0
and (CREATEDON between to_dateP_ParamDate1,'DD-MM-YYYY HH24:MI')
and to_dateP_ParamDate2,'DD-MM-YYYY HH24:MI') )
group By createdby, docid, createdon
having (count(*)>=2)
order by DOCID asc
Please, any assistance would be appreciated.
I am trying to create a simple report to count the amount of times a document is scanned by a scanner (i.e. group by "createdby")within a specified period, but to also including the date-time the image was created. My issue is that when I include the date-time in the group-by clause it returns no rows. I understand why it does this, but cannot fathom a way to include the date-time of the document in my report. "createdon" is a DATE field which cannot be grouped with the "createdby" and "docid" to give a result set, but I require the createdon value.
Select count(*) as COUNT,
DOCID as DOCUMENT_NUMBER, createdby as username, createdon
from SCOTT.ALL_DOCUMENTS
where SCOTT.ALL_DOCUMENTS.DOC_STATUS = 'SCANNED'
and CREATEDBY like 'domain1\drs%'
and DELETED =0
and (CREATEDON between to_dateP_ParamDate1,'DD-MM-YYYY HH24:MI')
and to_dateP_ParamDate2,'DD-MM-YYYY HH24:MI') )
group By createdby, docid, createdon
having (count(*)>=2)
order by DOCID asc
Please, any assistance would be appreciated.