惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
T
Threatpost
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - Franky
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
M
MIT News - Artificial intelligence
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
S
Security Affairs
P
Proofpoint News Feed
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
S
Security @ Cisco Blogs
H
Hacker News: Front Page
Security Archives - TechRepublic
Security Archives - TechRepublic
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
Know Your Adversary
Know Your Adversary
Y
Y Combinator Blog
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
月光博客
月光博客
量子位
博客园_首页
The Last Watchdog
The Last Watchdog
D
DataBreaches.Net
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
The Register - Security
The Register - Security
Schneier on Security
Schneier on Security
H
Help Net Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
L
Lohrmann on Cybersecurity
S
Secure Thoughts
Stack Overflow Blog
Stack Overflow Blog
Cloudbric
Cloudbric
Microsoft Security Blog
Microsoft Security Blog

博客园 - gz.net

gridview绑定问题 - gz.net - 博客园 好久没来了。共享一个自动生成编号的存储过程 jsp数据库大全 login Microsoft Windows SharePoint Services ASP.NET程序中常用代码汇总(一) - gz.net - 博客园 ASP.NET动态生成HTML页面 日语的初次认识 日语的初次认识 对于长时间装载的ASP.NET页面如何在客户端浏览器中显示进度? 检测远程URL是否存在的三种方法 ---转自孟子 Eclipse快速上手指南 自己动手用c#写控件 代价 五种提高 SQL 性能的方法 js教程 HTML教程 HTML教程 存储过程经验二
存储过程编写经验三
gz.net · 2004-09-06 · via 博客园 - gz.net

1.       了解表的连接原理,能力进阶的关键

1)  灵活性,左连接,右连接。。。

2)  查询效率,条件语句的写法和顺序,自己掌握优化的主动权。

3)  保证正确,如update from累加修改时

       update tMembers

                     set

                            iShareA  = a.iShareA + b.iNewShare

                     from vMembers a, (select * from vMembers) b

                     where a.iMemberID = b.iUpMemberID

       update tMembers

                     set

                            iShareA  = a.iShareA + b.iNewShare

                     from tMembers a, (select * from vMembers) b

                     where a.iMemberID = b.iUpMemberID

区别:

使用视图时,左侧iShareA 右侧a.iShareA不是同一条记录;使用表时是一条。

iShareA  = a.iShareA + b.iNewShare

2.       一些经验

2.1     善用临时表

1)避免多用户重名冲突。

2)  速度快,内存表。

3)  简化逻辑

4)  数据重用

2.2     回避not in 的技巧

  --打标记bMark = 1(下一步对bMark = 0 的进行插入,这样速度快得多)

  update #tWIV_Total set bMark = 1

  from

    #tWIV_Total a, tTWAccount b

  where

    a.cWhsID = b.cWhsID  and a.cItemID = b.cItemID and a.cVendorID = b.cVendorID

  -- 3)bMark = 0 的关键字插入到tTWAccount

  insert into tTWAccount (cWhsID, cItemID, cVendorID, cCtrGrpID) 

  select

    cWhsID,

    cItemID,

    cVendorID,

    '' -- because not null

  from

    #tWIV_Total

  where

    bMark = 0

2.3     浮点数慎用

1)  会有芯片运算影响等问题

2)  累计求和时,舍入误差,经常产生“1分钱问题”。

3)  运行中产生意外结果,如判断 = 0,本来是0,可能判断结果不为0

2.4     统计数字作分母时,注意筛选条件加上<> 0限制,如

                     select iLevel, count(*) iCount

                            into #tChainLevelCount

                            from tMembers a, tChainLevel b

                            where

                                   a.iLevel = b.iID

                                   and a.cState = '0' and b.cType = 'A'

                            group by iLevel

                            having count(*) > 0