2017年3月21日 星期二
2017年3月20日 星期一
不使用GROUP BY去sum
use Northwind;
select OrderID,CustomerID,Freight,(select sum(Freight) from Orders) As 合計 from Orders;
select OrderID,CustomerID,Freight,sum(Freight) over ( partition by 1 ) As 合計 from Orders;
備註:如果使用
select OrderID,CustomerID,Freight,sum(Freight) from Orders會有以下錯誤訊息
訊息 8120,層級 16,狀態 1,行 1
Column 'Orders.OrderID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
select OrderID,CustomerID,Freight,(select sum(Freight) from Orders) As 合計 from Orders;
select OrderID,CustomerID,Freight,sum(Freight) over ( partition by 1 ) As 合計 from Orders;
備註:如果使用
select OrderID,CustomerID,Freight,sum(Freight) from Orders會有以下錯誤訊息
訊息 8120,層級 16,狀態 1,行 1
Column 'Orders.OrderID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
2017年3月5日 星期日
2017年3月1日 星期三
aspx的後置程式碼(cs)使用Javascript
ClientScriptManager.RegisterStartupScript 方法
https://msdn.microsoft.com/zh-tw/library/z9h4dk8y(v=vs.110).aspx
ref:
[Asp.Net]Page.ClientScript.RegisterStartupScript 和 Page.ClientScript.RegisterClientScriptBlock 之間的差異
http://wupeiting.blogspot.tw/2010/07/aspnetpageclientscriptregisterstartupsc.html
https://msdn.microsoft.com/zh-tw/library/z9h4dk8y(v=vs.110).aspx
ref:
[Asp.Net]Page.ClientScript.RegisterStartupScript 和 Page.ClientScript.RegisterClientScriptBlock 之間的差異
http://wupeiting.blogspot.tw/2010/07/aspnetpageclientscriptregisterstartupsc.html
訂閱:
文章 (Atom)