我在经典的asp页面上运行以下查询.
sSQL = "Select ProductID, SUM(Quantity) FROM OrderDetails Where CAST(orderDate AS DATE) Between '"&sStartDate&"' And '"&sEndDate&"' GROUP BY ProductID"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sSQL, cnn, adOpenStatic, adLockReadOnly, adCmdText
<tr>
<td>
<%Response.Write(rs.Fields("ProductID"))%>
</td>
<td>
What is the code to get the sum of the quantity here?
</td>
Run Code Online (Sandbox Code Playgroud)
如何输出数量?
sSQL = "Select ProductID, SUM(Quantity) as TotalQuantity FROM OrderDetails Where CAST(orderDate AS DATE) Between '"&sStartDate&"' And '"&sEndDate&"' GROUP BY ProductID"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sSQL, cnn, adOpenStatic, adLockReadOnly, adCmdText
<tr>
<td>
<%Response.Write(rs.Fields("ProductID"))%>
</td>
<td>
<%= rs.Fields("TotalQuantity") %>
</td>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8023 次 |
| 最近记录: |