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的更多相关文章

  1. SQL Server判断对象是否存在 (if exists (select * from sysobjects )(转)

    1 判断数据库是否存在Sql代码 if exists (select * from sys.databases where name = ’数据库名’)    drop database [数据库名] ...

  2. 当SQL UPDATE遇到EXISTS(SELECT ...)时

    直接上例子. user表: ; -- ---------------------------- -- Table structure for user -- --------------------- ...

  3. SQL Server - select语句练习

    创建表和输入数据 CREATE TABLE STUDENT(SNO VARCHAR(3) NOT NULL,   SNAME VARCHAR(4) NOT NULL,   SSEX VARCHAR(2 ...

  4. SQL EXISTS

    一直对exists的用法不清楚,本次学习exists,并作出相应学习总结. 1.创造测试环境SYS@ora122>create table a(id )); SYS@ora122>inse ...

  5. Oracle SQL:select各类查询语句总结

    SQL查询语句总结 数据查询语言:即DML(Data Mannipulation Language)数据操纵语言,用于查询.操纵数据表资料行 本手册所有示例引用表均以TIPTOP GP  ERP数据库 ...

  6. 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 ...

  7. 关于SQL中SELECT *(星号)的危害论

    听闻有许多人是禁止开发人员在SQL中使用SELECT *的,这里翻译一下StackOverflow的一篇提问,个人认为相当客观 [SELECT *]危害主要有以下几点: 给数据消费者传数据的低效.当你 ...

  8. 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 ...

  9. 实例学习SQL的Select命令

    1.查找员工的编号.姓名.部门和出生日期,如果出生日期为空值,--显示日期不详,并按部门排序输出,日期格式为yyyy-mm-dd.select emp_no ,emp_name ,dept ,isnu ...

随机推荐

  1. opencv统计二值图黑白像素个数

    #include "iostream" #include "queue" #include "Windows.h" #include < ...

  2. (转)listview中常见难题总结

    原文地址:http://blog.csdn.net/cherry609195946/article/details/8844224 1. PopWindow中listview的item获取不到点击事件 ...

  3. ASP.NET MVC 路由调试工具Router Debugger

    直接上图 安装好手动启用或关闭 我开始调试我之前程序中由于路由遇到的问题 当发出 http://localhost:2362/109.html 这样请求, 我的意图是想Article的Details被 ...

  4. htpasswd命令

    htpasswd命令是Apache的Web服务器内置工具,用于创建和更新储存用户名.域和用户基本认证的密码文件. 语法 htpasswd(选项)(参数) 选项 -c:创建一个加密文件:-n:不更新加密 ...

  5. PHP设定错误和异常处理三函数

    register_shutdown_function(array('Debug','fatalError')); //定义PHP程序执行完成后执行的函数 set_error_handler(array ...

  6. 【leetcode】N-Queens

    N-Queens The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no tw ...

  7. python之errno

    http://www.cnblogs.com/Security-Darren/p/4168392.html errno.EWOULDBLOCK 操作将会阻塞

  8. Unity3d 枚举某个目录下所有资源

    using UnityEngine; using System.Collections; using UnityEditor; using System.Collections.Generic; us ...

  9. socket端口重复占用问题

    1.一个服务端进程在主动释放端口后(调用close)端口状态为TIME_WAIT,这时再去监听同样的端口,不论是否设置SO_REUSEADDR,都能监听成功,也能接收到客户端的连接,但是无法收到数据. ...

  10. 3.js模式-策略模式

    1. 策略模式 策略模式定义一系列的算法,把它们封装起来,并且可以互相替换. var strategies = { isNonEmpty: function(value,errMsg){ if(val ...