title: Error Code: 1054. Unknown column in 'field list'
body: <p>Please help I am trying to execute the following stored procedure. I receive an error message stating that Error Code: 1054. Unknown column 'bpc2016.entity' in 'field list'. The error disappears when I take out the reference to industryPY in the industryCY view. Please help the table and column exist in the database.</p>
  
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `getAbudgetnow`()
  BEGIN
  CREATE OR REPLACE VIEW industryPY
  AS
  SELECT
  alet.area AS 'area',
  alet.industry_description AS 'industry_desc',
  alet.industry AS 'industry',
  alet.percentage AS 'perc',
  ref_data.product AS 'product',
  ref_data.pz AS 'pz',
  ref_data.rate AS 'amount'
  FROM
  alet
  RIGHT JOIN
  ref_data ON (alet.industry = ref_data.industry and alet.area = ref_data.area)
  WHERE alet.industry IS NOT NULL;
  
  CREATE OR REPLACE VIEW industryCY
  AS
  SELECT
  bpc2016.entity AS 'entity',
  bpc2016.plant AS 'plant',
  bpc2016.product_desc AS 'product_desc',
  bpc2016.product AS 'product',
  bpc2016.customer AS 'customer',
  bpc2016.route AS 'route',
  bpc2016.pz_desc AS 'pz_desc',
  bpc2016.pz AS 'pz',
  bpc2016.amount AS 'amount',
  industryPY.area AS 'area',
  industryPY.industry_desc AS 'industry_desc',
  industryPY.industry AS 'industry',
  industryPY.perc AS 'percentage',
  industryPY.amount AS 'PYamount',
  TRUNCATE(bpc2016.amount*industryPY.perc,2) AS 'budget_2016_vol'
  FROM
  bpc2016
  FULL JOIN
  industryPY ON (bpc2016.pz = industryPY.pz and bpc2016.product = industryPY.product);
  
  END
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ENjgc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ENjgc.png" alt="enter image description here"></a></p>
  
  <p>'bpc2016', (\n<br>
  <code>entity</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>plant</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>product_desc</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>product</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>interplant</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>customer</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>route</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>pz_desc</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>pz</code> varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT \'\',\n<br>
  <code>amount</code> float NOT NULL DEFAULT \'0\'\n) ENGINE=InnoDB DEFAULT CHARSET=latin1'</p>