SQL exists( select 1 from
use UnlockIndustry select * from Info_Coordinate as A
join Info_Employee on A.EmployeeId=Info_Employee.EmployeeId
Where exists( select 1 from ( select EmployeeId,MAX(CreateTime) as CreateTime from Info_Coordinate group by Info_Coordinate.EmployeeId ) as b
where A.EmployeeId=b.EmployeeId and A.CreateTime=b.CreateTime)
And Info_Employee.CompanyId='1306010001'
/*
关联人员和地址表。 select * from info_A as A JOIN Info_B ON A.id=Info_B.id where exists() and info_B.Cid=''
*/
例子:
______________________________________________________________________________
use MyMvc
select * from Info_Company
select * from Info_Empoyee
select * from Info_Empoyee left Join Info_Company on Info_Empoyee.CompanyID=Info_Company.CompanyID
select * from Info_Empoyee where exists(select 1 from Info_Company where Info_Empoyee.CompanyId=Info_Company.CompanyID)

SQL exists( select 1 from的更多相关文章
- SQL Server判断对象是否存在 (if exists (select * from sysobjects )(转)
1 判断数据库是否存在Sql代码 if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名] ...
- 当SQL UPDATE遇到EXISTS(SELECT ...)时
直接上例子. user表: ; -- ---------------------------- -- Table structure for user -- --------------------- ...
- SQL Server - select语句练习
创建表和输入数据 CREATE TABLE STUDENT(SNO VARCHAR(3) NOT NULL, SNAME VARCHAR(4) NOT NULL, SSEX VARCHAR(2 ...
- SQL EXISTS
一直对exists的用法不清楚,本次学习exists,并作出相应学习总结. 1.创造测试环境SYS@ora122>create table a(id )); SYS@ora122>inse ...
- Oracle SQL:select各类查询语句总结
SQL查询语句总结 数据查询语言:即DML(Data Mannipulation Language)数据操纵语言,用于查询.操纵数据表资料行 本手册所有示例引用表均以TIPTOP GP ERP数据库 ...
- SQL学习--Select(一)TOP、派生表、连接、谓词
TOP关键字 WITH TIES t.title,sum(s.qty)as totalSales from sales s left join titles t on s.title_id=t.tit ...
- 关于SQL中SELECT *(星号)的危害论
听闻有许多人是禁止开发人员在SQL中使用SELECT *的,这里翻译一下StackOverflow的一篇提问,个人认为相当客观 [SELECT *]危害主要有以下几点: 给数据消费者传数据的低效.当你 ...
- LINQ系列:LINQ to SQL Exists/In/Any/All/Contains
1. Any 返回没有Product的Category var expr = from c in context.Categories where !c.Products.Any() select c ...
- 实例学习SQL的Select命令
1.查找员工的编号.姓名.部门和出生日期,如果出生日期为空值,--显示日期不详,并按部门排序输出,日期格式为yyyy-mm-dd.select emp_no ,emp_name ,dept ,isnu ...
随机推荐
- Spatial pyramid pooling (SPP)-net (空间金字塔池化)笔记(转)
在学习r-cnn系列时,一直看到SPP-net的身影,许多有疑问的地方在这篇论文里找到了答案. 论文:Spatial Pyramid Pooling in Deep Convolutional Net ...
- net-snmp的MIBs扩展(linux下)
net-snmp的MIBs扩展 net-snmp的MIBs扩展 1 编译安装net-snmp 2 编写MIB文件 MIB文件描述 一个简单的示例 3 使自定义的MIB文件生效 4 实现agent代理程 ...
- iis不支持下载apk的解决办法
添加mime类型即可 扩展名:".apk", MIME类型:"application/vnd.android.package-archive"
- C++ 输出调试的一些技巧
主要利用了宏和stderr... #define enable_debug #ifdef enable_debug FILL some macros/functions here #else /// ...
- GMM简单解释
1.GMM(guassian mixture model) 混合高斯模型,顾名思义,就是用多个带有权重的高斯密度函数来描述数据的分布情况.理论上来说,高斯分量越多,极值点越多,混合高斯密度函数可以逼近 ...
- ubuntu 安装 phpmyadmin
安装步骤 1 apt-get install phpmyadmin 2 安装完后默认的安装位置是在/usr/share 而不是在/var/www 所以 需要将其链接到/var/www来,复制的话貌似需 ...
- iOS App Extensions 推荐文章
写的非常不错,读完后,基本的extension的套路就清楚了,也是我们的园友写的,感谢他: http://www.cnblogs.com/xdream86/p/3855932.html 下面这个教程是 ...
- ios UIWindow 错误使用导致无法接收motionEnded(摇一摇)函数
今天遇到一个问题,第一次运行程序时,- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event函数无法调用,第二次就好了 ...
- jquery 常用的备忘
1.table 取 tr 的 id值 <table class="table table-striped table-hover table-bordered" id=&q ...
- 全能直播王PC版-0707-full_codecs
全能直播王是一款高清流畅的全平台的电视直播应用,让您随时随地看高清电视直播. [全能特色] 1. 收录全国1400多个直播频道,包括湖南卫视.江苏卫视.浙江卫视等热门频道. 2. 频道多线路自动选择, ...