Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can start with something like this:</p> <pre><code>SELECT logTypeId, Count(logTypeId) AS nbTotal, -1 * Sum(isResolved) AS nbTrue, Count(logTypeId) + Sum(isResolved) As nbFalse FROM TLogging GROUP BY logTypeId; </code></pre> <p>It gives about the same result as you want, but transposed.</p> <p>EDIT: or this, it's ugly but i think it gives exactly the result you want</p> <pre><code>SELECT 'True' As Resolved, t0.nb As LogType0, t1.nb As LogType1, t2.nb As LogType2, t3.nb As LogType3, t4.nb As LogType4, t5.nb As LogType5 FROM (Select -1 * Sum(isResolved) As nb From TLogging Where logTypeId = 0) AS t0 , (Select -1 * Sum(isResolved) As nb From TLogging Where logTypeId = 1) AS t1 , (Select -1 * Sum(isResolved) As nb From TLogging Where logTypeId = 2) AS t2 , (Select -1 * Sum(isResolved) As nb From TLogging Where logTypeId = 3) AS t3 , (Select -1 * Sum(isResolved) As nb From TLogging Where logTypeId = 4) AS t4 , (Select -1 * Sum(isResolved) As nb From TLogging Where logTypeId = 5) AS t5 Union All SELECT 'False' As Resolved, t0.nb As LogType0, t1.nb As LogType1, t2.nb As LogType2, t3.nb As LogType3, t4.nb As LogType4, t5.nb As LogType5 FROM (Select Count(*) + Sum(isResolved) As nb From TLogging Where logTypeId = 0) AS t0 , (Select Count(*) + Sum(isResolved) As nb From TLogging Where logTypeId = 1) AS t1 , (Select Count(*) + Sum(isResolved) As nb From TLogging Where logTypeId = 2) AS t2 , (Select Count(*) + Sum(isResolved) As nb From TLogging Where logTypeId = 3) AS t3 , (Select Count(*) + Sum(isResolved) As nb From TLogging Where logTypeId = 4) AS t4 , (Select Count(*) + Sum(isResolved) As nb From TLogging Where logTypeId = 5) AS t5 Union All SELECT 'All' As Resolved, t0.nb As LogType0, t1.nb As LogType1, t2.nb As LogType2, t3.nb As LogType3, t4.nb As LogType4, t5.nb As LogType5 FROM (Select Count(*) As nb From TLogging Where logTypeId = 0) AS t0 , (Select Count(*) As nb From TLogging Where logTypeId = 1) AS t1 , (Select Count(*) As nb From TLogging Where logTypeId = 2) AS t2 , (Select Count(*) As nb From TLogging Where logTypeId = 3) AS t3 , (Select Count(*) As nb From TLogging Where logTypeId = 4) AS t4 , (Select Count(*) As nb From TLogging Where logTypeId = 5) AS t5 ; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload