[英]incorrect syntax near keyword select expecting as
我有以下步骤
Create procedure Getdatewiseprofitrecord
@Date date
As
Begin
select *into #temptable from(select prof.Productid, SUM(prof.Amount)Amount,SUM(prof.QuantitySold)Quantitysold,SUM(prof.ProfitAmount) from ProfitRecord prof
where prof.Date=@Date
group by Productid)
select temp.*,pro.ProductName from #temptable temp
inner join Productinfo pro on temp.Productid=pro.ProductId
drop table #temptable
End
但是我incorrect syntax near keyword expecting as,id or...
得到了incorrect syntax near keyword expecting as,id or...
我不知道这个问题。
你可以试试看吗?
CREATE PROCEDURE Getdatewiseprofitrecord
@Date DATE
AS
BEGIN
SELECT *
INTO #temptable
FROM (SELECT prof.Productid, SUM(prof.Amount) Amount,SUM(prof.QuantitySold) Quantitysold,SUM(prof.ProfitAmount) ProfitAmount
FROM ProfitRecord prof
WHERE prof.Date = @Date
GROUP BY Productid)
SELECT temp.*,
pro.ProductName
FROM #temptable temp
JOIN Productinfo pro on temp.Productid = pro.ProductId
DROP TABLE #temptable
END
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.