Bug #38649 View's SELECT contains a variable or parameter
Submitted: 8 Aug 2008 2:00 Modified: 8 Aug 2008 4:28
Reporter: Daniel Penza Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Views Severity:S3 (Non-critical)
Version:5.0.51a OS:Windows
Assigned to: CPU Architecture:Any
Tags: create view

[8 Aug 2008 2:00] Daniel Penza
Description:
Hellow:
When I want to create a view, MySQL reports the following error:
"View's SELECT contains a variable or parameter."

The 'Alias' Amount assigned to (Quant * Price) is used in the next field 'Total'

CREATE TABLE `TableA` (Id INT(4),Price Decimal(10,2),Cant Decimal(10,2),Discount Decimal(10,2));

Create View 'TotalLines' as SELECT Cant * Price as Amount, Amount * (100-Discount)/100 as Total From TableA;

How to repeat:
CREATE TABLE `TableA` (Id INT(4),Price Decimal(10,2),Quant Decimal(10,2),Discount Decimal(10,2));

Create View 'TotalLines' as SELECT Quant * Price as Amount, Amount * (100-Discount)/100 as Total From TableA;

Suggested fix:
it would be extremely usefull,

The 'Alias' Amount assigned to (Quant * Price) may be used in the next field 'Total'

in resume:
I could do some thing like:
Select (A + B) as C, (C + D) as E From TableA
[8 Aug 2008 4:28] Valeriy Kravchuk
This is a duplicate of bug #38651.