Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks like you would want to wrap your existing query into another one such as...</p> <pre><code>select PQ.*, case when PQ.Test1 IS NULL then ' ' when PQ.Test1 &lt; 50 then '&lt; 50' when PQ.Test1 &gt; 100 then '&gt; 100' else PQ.Test1 end as FinalTest1, case when PQ.Test2 IS NULL then ' ' when PQ.Test2 &lt; 50 then '&lt; 50' when PQ.Test2 &gt; 100 then '&gt; 100' else PQ.Test2 end as FinalTest2, case when PQ.Test3 IS NULL then ' ' when PQ.Test3 &lt; 50 then '&lt; 50' when PQ.Test3 &gt; 100 then '&gt; 100' else PQ.Test3 end as FinalTest3, case when PQ.Test4 IS NULL then ' ' when PQ.Test4 &lt; 50 then '&lt; 50' when PQ.Test4 &gt; 100 then '&gt; 100' else PQ.Test4 end as FinalTest4, case when PQ.Test5 IS NULL then ' ' when PQ.Test5 &lt; 50 then '&lt; 50' when PQ.Test5 &gt; 100 then '&gt; 100' else PQ.Test5 end as FinalTest5, case when PQ.Test6 IS NULL then ' ' when PQ.Test6 &lt; 50 then '&lt; 50' when PQ.Test6 &gt; 100 then '&gt; 100' else PQ.Test6 end as FinalTest6 from ( Your Full Query ) as PQ </code></pre> <p>Follow-up per comments</p> <p>If your query is getting any record, then my version should too. From your original query to deal with the column renaming, I would adjust </p> <p>FROM</p> <pre><code>MAX( blah blah ) AS TEST1, </code></pre> <p>TO</p> <pre><code>MAX( blah blah ) AS preTEST1, </code></pre> <p>Same for columns Test2-6</p> <p>Then, change my above query from</p> <pre><code> case when PQ.preTest1 IS NULL then ' ' when PQ.preTest1 &lt; 50 then '&lt; 50' when PQ.preTest1 &gt; 100 then '&gt; 100' else PQ.preTest1 end as Test1, </code></pre> <p>etc for 2-6. The rest of my original query remains unchanged otherwise... It is still relying on results from your query. You can also EDIT your existing post and put your revised query there for me to look at. If the inner portion query returns nothing, then my outer query won't either.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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