PL/SQL-How to implement multiple count statements in a single query when tables and conditions are all different
<p>I'm working on Open Text Content Server Tool that uses PL/SQL Database. What I am trying to do is to fetch count data through 6 different queries all having different conditions and different tables too. I was trying to combine all these 6 count queries but no luck. Below are those 6 queries listed :</p>

<p>Documents Created in A Month:</p>

<pre><code>select count (dataid) from Dtree where 
Createdate &gt;= %1 and createdate &lt;= %2 and subtype = 144
</code></pre>

<p>Total No of Users:</p>

<pre><code>select count(a.id) from Kuaf a, kuaf b where 
a.deleted =0 and a.type =0 and b.id = a.groupid
</code></pre>

<p>Unique Users Logged in a Month(Count):</p>

<pre><code>Select count (distinct (performerID))
from dauditnew where auditid=23 and auditdate &gt;= %1 and auditdate &lt;= %2
</code></pre>

<p>Users Created in a Month(Count):</p>

<pre><code>Select Count(dataid) FROM DAUDITNEW where AUDITID = 1 
AND AUDITSTR LIKE 'Create' and subtype=142 AND 
auditdate &gt;= %1 and auditdate &lt;= %2
</code></pre>

<p>Users Deleted(Count):</p>

<pre><code>SELECT count(a.userid) from dauditnew a WHERE
a.auditstr = 'Delete' AND 
a.AuditDate &gt;= %1 AND 
a.AuditDate &lt;= %2 AND 
a.UserID in (Select ID from KUAF where Deleted = 1 and Type=0)
</code></pre>

<p>Workflows Initiated:</p>

<pre><code>Select count(*) from Wworkaudit WWA where WWA.workaudit_status=1 AND 
WWA.workaudit_date &gt;= %1 and WWA.workaudit_date &lt;= %2
</code></pre>

<p>Here %1,%2 denote user inputs. Since these 6 queries all have very different conditions, it seems a daunting task for me to combine them. Please help me out. </p>

<p>Thank You.</p>