title: #1349 - View's SELECT contains a subquery in the FROM clause
body: <p>I need to modify MySQL code to pass this error and get the same result.</p>
  
  <hr>
  
  <p><strong>I use localhost with Xampp ..</strong> </p>
  
  <ul>
  <li>Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1</li>
  <li>Server type: MariaDB</li>
  <li>Server version: 10.1.30-MariaDB - mariadb.org binary distribution</li>
  <li>Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407</li>
  <li>PhpMyAdmin Version information: 4.7.4, latest stable version: 4.9.1</li>
  </ul>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE VIEW product_variation_stock_view AS
                  SELECT 
                      product_variations.product_id AS product_id,
                      product_variations.id AS product_variation_id,
                      COALESCE(SUM(stocks.quantity) - COALESCE(SUM(product_variation_order.quantity), 0), 0) AS stock,
                      CASE WHEN COALESCE(SUM(stocks.quantity) - COALESCE(SUM(product_variation_order.quantity), 0), 0) &gt; 0
                          THEN true
                          ELSE false
                      END in_stock
                  FROM product_variations
                  LEFT JOIN(
                      SELECT stocks.product_variation_id AS id,
                      SUM(stocks.quantity) AS quantity
                      FROM stocks
                      GROUP BY stocks.product_variation_id
                  ) AS stocks USING (id)
                  LEFT JOIN (
                      SELECT
                          product_variation_order.product_variation_id AS id,
                          SUM(product_variation_order.quantity) AS quantity
                      FROM product_variation_order
                      GROUP BY product_variation_order.product_variation_id
                  ) AS product_variation_order USING (id)
                  GROUP BY product_variations.id
  </code></pre>
  
  <p>MySQL said:</p>
  
  <blockquote>
    <p>#1349 - View's SELECT contains a subquery in the FROM clause</p>
  </blockquote>