title: Re-Constructing a query for a CREATE VIEW without using subqueries?
body: <p>My Query works fine when I run it on the Database but once I attempt to create a view I get hit with (ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause). I have read some other posts and the problem seems to I cant write subqueries within the view on the current DB version. How would I restructure the query below to accomplish the same end goal:</p>
  <pre><code>CREATE VIEW vHW2_3_mmirkovi as (
  SELECT n.Name, sum(n.profit) AS profit
  
  FROM (SELECT v.Name, (p.sell_Price - p.cost) AS profit FROM dreamhome.A_Vendors AS v
      
  INNER JOIN dreamhome.A_Products AS p ON v.V_Id = p.V_Id) AS n GROUP BY n.name ;)
  </code></pre>
  <p>The query without the create view statement yields</p>
  <pre><code>+--------+--------+
  | Name   | profit |
  +--------+--------+
  | Austin |     10 |
  | Grant  |     50 |
  | James  |    290 |
  | Wendy  |     10 |
  +--------+--------+
  4 rows in set (0.00 sec)
  </code></pre>