В чем проблема синтаксиса Declare?
Вечер добрый, в чем проблема синтаксиса?
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE @sum money, @id int, @prodid int, @name nvarchar(20)' at line 1 0.000 sec
use sakila;
DECLARE @sum money, @id int, @prodid int, @name nvarchar(20);
SET @id = 2;
select @sum = sum(Orders.Price*Orders.ProductCount),
@name = Products.ProductName, @prodid = Products.Id
from orders
inner join Products on ProductId = Products.Id
group by Products.ProductName, Products.Id
having Products.Id = @id
PRINT 'Товар ' + @name + 'продан на сумму '+str(@sum)