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

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - IT Person

算法 《微软的秘密》读书笔记 经典思维50法 SQL Server 2008 T-SQL编程系列课程之T-SQL标准语法 ASP.NET 4风云之旅系列之ASP.NET 4对开发人员的核心运行时新特性 ASP.NET 4 风云之旅系列之ASP.NET MVC 2的新特性 ASP.NET 4 风云之旅系列之Visual Studio 2010在Web开发方面的新特性 ASP.NET开发实践系列课程之Web应用的安全攻防之网页木马 ASP.NET开发实践系列课程之ASP.NET综合调优 从架构设计到系统实施-基于Windows Server 2008的全新企业应用之Card Space身份验证 从架构设计到系统实施-基于.NET 3.0的全新企业应用之开发Vista边栏应用 从架构设计到系统实施-基于.NET 3.0的全新企业应用之开发基于MMC 3.0的管理工具 从架构设计到系统实施-基于.NET 3.0的全新企业应用之加入Silverlight支持 从架构设计到系统实施-基于.NET 3.0的全新企业应用之设计基于WPF的客户端 从架构设计到系统实施-基于.NET 3.0的全新企业应用之设计基于AJAX和IIS7的网站 - IT Person 从架构设计到系统实施-基于.NET 3.0的全新企业应用之设计基于WF的工作流 从架构设计到系统实施-基于.NET 3.0的全新企业应用之基于WCF的系统服务 - IT Person 深度剖析Workflow Foundation之Workflow Activities 深度剖析Workflow Foundation之开发流程(下)
SQL Server 2008 T-SQL编程系列课程之常用查询算法比较
IT Person · 2010-04-05 · via 博客园 - IT Person

create table table_A(id int, testCol varchar(256));
create table table_B(id int, testCol varchar(256));
insert into table_A
select 1,'A'
union all
select 2,'B';

insert into table_B
select 1,'A'
union all
select 2,'B';

1.from
2.on
3.join
4.where


select * from table_A,table_B
where table_A.id=table_B.id;

建议写法
select * from table_A inner join table_B on table_A.id=table_B.id;

select * from table_A left join table_B on table_A.id=table_B.id;

select * from table_A right join table_B on table_A.id=table_B.id;

子查询
select * from table_A where id in (select id from table_B);

每个表中都会有主键,根据ID去除列的重复数据
select * from table_B b where not exists(select * from table_B where testCol=b.testCol and id > b.id);

日期分表查询
对于年在一百万以下的数据,可以按年分,否则还得按月分