易截截图软件、单文件、免安装、纯绿色、仅160KB

优化SQL - .NET技术 / ASP.NET

update a set 
a.P = isnull( ( select top 1 P from B b where a.I >= b.SI and a.I <= b.EI order by (b.EI-b.SI) ),'') ,
a.C = isnull( ( select top 1 C from B b where a.I >= b.SI and a.I <= b.EI order by (b.EI-b.SI) ),'')
from A a
更新语句order by 就不要了..

B.P和B.C的默认值由NULL改成'',这样就省判断了

不用 order by 不能保证数据顺序
 Null 是没有找到的时候 默认设置

数据库设计存在问题。

没办法优化了吗?
sql2000 的数据库

SQL code:
update A set
A.P = isnull( c.P,'') ,
A.C = isnull( c.C,'')
from B
where A.I >= B.SI
and A.I <= B.EI
and (B.EI - B.SI) = min(B.EI - B.SI)


???

怎么看都不对劲。。。。

取top 1的方法没有别的条件可以替代的吗?
比如用某个字段或某几个字段过滤?

引用
SQL code
update A set
A.P = isnull( c.P,'') ,
A.C = isnull( c.C,'')
from B
where A.I >= B.SI
and A.I <= B.EI
and (B.EI - B.SI) = min(B.EI - B.SI)
???


where 条件下 能用 聚合函数吗?
应该是不行的吧

引用
where 条件下 能用 聚合函数吗?
应该是不行的吧


大意了。。。
的确是不行


相关问答:

asp.net导出EXCEL问题! - .NET技术 / ASP.NET

C# code:

SqlConnection conn = CsDB.sqlcon();
SqlDataAdapter da = new SqlDataAdapter("select fwCoding from bjmuma_fwCoding where OrderNumber='" + Order + & ......

asp.net程序员求职 - .NET技术 / 非技术区

本人工作经验一年以上
熟悉asp.net
熟悉javascript
熟悉Css
熟悉ajax
熟悉sqlserver2005
有一年的项目经验
具体项目和其他的就不在这写了
有意者联系:
QQ:359233910
引用
本人工作经验一年以上
熟悉asp ......

AJAX 后台怎么取不到直 - .NET技术 / ASP.NET

代码如下 请高手 指点下 谢谢
ajax_http.js
-------------
function getXMLHTTP() {
  var xmlhttp;
  if (window.ActiveXObject) {
  //IE
  try {
  ......

asp 翻页怎么实现? - .NET技术 / ASP.NET

asp 翻页怎么实现?
分页可使用分页控件如aspnetpager

没找到此控件!!!!!

第三方组件 需要在网上去下载 http://www.webdiyer.com/Controls/AspNetPager/Downloads

不用控件 怎么做啊!

hehe

不 ......

asp.net 二叉树 treeview - .NET技术 / ASP.NET

O O O O O O
  |.......| |........| |.......|
  | | |
  O O ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号