how to determint wether two column equals
question:
How to determint wether two column equals?
Answer:
Table one:RecordId = 1,CommonId = 5,Approved = 1.
RecordId = 2,CommonId = 5 Approved = 0.
Table two:RecordId = 4,CommonId = 9,Approved = 1.
case one:if you are compare in the one table.
you can use the following code
select commonId,
(case when max(Approved) = min(Approved) then else end) as IsEqual
from MyTable A
group by commonId;
case two:if you are compare in the two tables.
you can use the following code.
SELECT
CASE
WHEN (A.Approved = B.Approved) THEN
ELSE
END
FROM MyTable A,
MyTable B
WHERE A.commonId = B.commonId;
Note:you need modify condition A.Approved = B.Approved only ,in compare two tables different column.
how to determint wether two column equals的更多相关文章
- jdbcTemplate的Dao层封装
package com.easyrail.base.dao; import java.io.Serializable; import java.lang.reflect.Field; import j ...
- Java学习笔记之使用反射+泛型构建通用DAO
PS:最近简单的学了学后台Servlet+JSP.也就只能学到这里了.没那么多精力去学SSH了,毕竟Android还有很多东西都没学完.. 学习内容: 1.如何使用反射+泛型构建通用DAO. 1.使用 ...
- Oracle connect by 树查询之三(超详细)
查找员工编号为7369的领导: 1 SELECT LEVEL,E.* FROM EMP E CONNECT BY PRIOR E.MGR = E.EMPNO START WITH E.EMPNO = ...
- Spring-JDBC通用Dao
JdbcBaseDao JdbcBaseDao接口,内容如下: package com.sun4j.core.jdbc.dao; import java.io.Serializable; import ...
- 自定义UICollectionViewLayout并添加UIDynamic - scorpiozj(转)
转载自:http://www.tuicool.com/articles/jM77Vf 自定义UICollectionViewLayout并添加UIDynamic UICollectionVie ...
- 自定义注解与MYSQL
无聊之作,可以提意见,但别嘲笑啊 package bean; import java.sql.Date; import annotationK.annotation.Column; import an ...
- cf448D Multiplication Table
D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces Round #277.5 (Div. 2) A,B,C,D,E,F题解
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud A. SwapSort time limit per test 1 seco ...
- Codeforces Round #256 (Div. 2) 题解
Problem A: A. Rewards time limit per test 1 second memory limit per test 256 megabytes input standar ...
随机推荐
- P3243 [HNOI2015]菜肴制作
传送门 把时间看成数,菜肴看成位置 考虑一个位置填什么数很麻烦 考虑一个数放在什么位置 一开始我想的是,对于一个限制 $(a,b)$ ,从 $a$ 往 $b$ 连一条边,然后如果有解则所有的限制构成了 ...
- 天梯赛easy题
2 #include<iostream> #include<algorithm> #include<cstdio> #include<cstring> ...
- win7和centos7双系统--转
转自http://blog.chinaunix.net/uid-30867756-id-5758575.html 参考:http://blog.csdn.net/hsg77/article/detai ...
- SpringMVC HandlerMethodArgumentResolver自定义参数转换器
来源: https://www.cnblogs.com/daxin/p/3296493.html 自定义Spring MVC3的参数映射和返回值映射 + fastjson首先说一下场景:在一些富客户端 ...
- 抽象工厂方法模式(Abstract Factory Pattern)
Provide an interface for creating families of related or dependent objects without specifying their ...
- Angular4+NodeJs+MySQL 入门-04 接口调用类
上一篇文章说一下,后台接口的创建,这篇说一下如果调用接口. 创建一个目录helpers 此目录下有三个文件分别是 ApiClient.ts.clientMiddleware.ts.Core.ts,前面 ...
- MongoDB数据库进阶 --- 增删查改...
注意: monogdb数据在使用之后必须及时 mongodb.close()否则后台崩溃. 在之前的文章中,我已经介绍了什么事MongoDB以及怎么在windows下安装MongoDB等等基本知识. ...
- TOJ 3660 家庭关系
描述 给定若干家庭成员之间的关系,判断2个人是否属于同一家庭,即2个人之间均可以通过这些关系直接或者间接联系. 输入 输入数据有多组,每组数据的第一行为一个正整数n(1<=n<=100), ...
- 关于重定向printf出错 Error[Pe020]: identifier "FILE" is undefined 解决方案
IAR或者Keil用到重定向printf函数出现的错误解决方案 转发请注明出处,谢谢 原创:李剀 https://www.cnblogs.com/kevin-nancy/articles/105851 ...
- 支付宝小程序与微信小程序开发功能和语法糖不同
最近开始负责公司webapp数据打通支付宝小程序,之前已经打通了微信小程序,现在根据支付宝小程序的开发文档在之前的模板上面做修改. 在修改模板的过程中,总结一下双方功能和语法糖的不同之处. 框架: a ...