title: SQL Server: select count of rows with not empty fields and total count of rows
body: <p>Table has 4 int columns (Price0, Price1, Price2, Price3). </p>
  
  <p>Example of table:</p>
  
  <pre><code>ID | Price0 | Price1 | Price2 | Price3 |
  ---+--------+--------+--------+--------+
   1 |   10   |   20   |  NULL  |  NULL  |
   2 |   70   |  NULL  |  NULL  |  NULL  |
   3 |   30   |   40   |   50   |  NULL  |
  </code></pre>
  
  <p>How to query this table to get</p>
  
  <ol>
  <li>total count of rows</li>
  <li>and count of rows where count of filled Price columns >= N (for example N = 2)</li>
  </ol>
  
  <p>Result must be:</p>
  
  <pre><code>Total | Filled
  ------+-------
    3   |   2
  </code></pre>
  
  <p>This query show how many Price fileds is filled in each row</p>
  
  <pre><code>select
      (select count(*) as filledFieldsCount
       from (values (T.Price0), (T.Price1), (T.Price2), (T.Price3)) as v(col)
       where v.col is not null
      )
  from Table1 T
  </code></pre>