这个select 语句要怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/25 11:26:42
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select Pono,Date,Style,Customer,Factory,sum(TotalPrice) as Total_Price from Statistics where Date between #" & FirstDate & "# And #" & EndDate & "# and Factory='"&Factory&"' roup by Date order by id desc"
最后输出"Total_Price "
请要这个语句要怎么改才正确!如何输出显示Total_Price的值
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select Pono,Date,Style,Customer,Factory,sum(TotalPrice) as Total_Price from Statistics where Date between #" & FirstDate & "# And #" & EndDate & "# and Factory='"&Factory&"' group by Date order by id desc"

如果你想计算每日的订单总额应该是:
sql="select Date,sum(TotalPrice) as Total_Price from Statistics where Date between #" & FirstDate & "# And #" & EndDate & "# and Factory='"&Factory&"' group by Date order by Date desc"
如果你想要更多新信息:
sql="select Pono,Date,Style,Customer,Factory,sum(TotalPrice) as Total_Price from Statistics where Date between #" & FirstDate & "# And #" & EndDate & "# and Factory='"&Factory&"' group by Pono,Date,Style,Customer,Factory,id order by id desc"
select后非聚集运算Column必须出现在group by后。

<%=rs("Total_Price")%>

没有发现任何问题,是不是还想求个总计??