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 ...
随机推荐
- 14个Xcode中常用的快捷键操作(转)
2014-12-24 17:31 编辑: suiling 分类:iOS开发 来源:iPhoneDev.tv 13 31621 Xcode 6Xcode快捷键 招聘信息: 开发工程师 iOS开发工程师 ...
- UIView动画效果
做出UI界面,实现程序功能,是重中之重,但是通过动画提升使用体验,一般人应该不会拒绝吧. 那么问题又来了,怎么做? 一: 稳扎稳打: 一步一步来吧,毕竟,心急吃不了热豆腐. 1.开启一个动画 2,设置 ...
- RouterOS首次打开网页强制跳转
网上极少有关于RouterOS的第一次打开网页强制跳转主页的方法,大多数都方法是将浏览某个域名的IP地址跳转到自己的主页,这种方法有时会失效.还有一种方法就是当用户用80端口连接时,抓取源地址到地址列 ...
- Eclipse中项目红叉但找不到错误解决方法
首先windows-show view-problems 根据地址查找错误 若提示: Description Resource Path Location TypeJava c ...
- Alien Dictionary
There is a new alien language which uses the latin alphabet. However, the order among letters are un ...
- 【leetcode】Word Break II
Word Break II Given a string s and a dictionary of words dict, add spaces in s to construct a senten ...
- hdu 1195
题意:就是给你n组的四位数,在一次变化中又一位数字可以变化,而变化的方式为加一减一或者是与隔壁的互换,注意,是每一个数字都可以, 求最少的变化次数到达目标的数字 一看这个就应该知道这是一个bfs的题目 ...
- struts2 如何实现mvc 的?
- IDEA 编译时报错 “未结束的字符串文字” “解析时已经达到文件结尾”
Information:Using javac 1.7.0_75 to compile java sourcesInformation:java: Errors occurred while comp ...
- 【转】Git如何Check Out出指定文件或者文件夹
[转]Git如何Check Out出指定文件或者文件夹http://www.handaoliang.com/a/20140506/195406.html 在进行项目开发的时候,有时候会有这样的需求那就 ...