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 ...
随机推荐
- dotnet体系结构
一.C#与.NET的关系 1.粗略地説,.net是一种在Windows平台上的编程架构————一种API. 2.C#编译器专门用于.net,这表示用C#编写的所有代码总是使用.NET Framewor ...
- hibernate实现学生-课程-成绩
1.实体类Student package com.test.model; import javax.persistence.Entity; import javax.persistence.Gener ...
- python 函数的递归
递归:简单来说就是自己调用自己 这里我们又要举个例子来说明递归能做的事情. 例一: 现在你们问我,alex老师多大了?我说我不告诉你,但alex比 egon 大两岁. 你想知道alex多大,你是不是还 ...
- poj2393tmp
#include"iostream" #include"stdio.h" #include"algorithm" using namespa ...
- log4net sqlite
<?xml version="1.0" encoding="utf-8" ?><log4net> <appender name=& ...
- windows同时安装python2和python3两个版本
1.安装python2 下载地址: https://www.python.org/downloads/windows/ 进入页面,下拉,64位系统要选择这个. 下载完成后,一直点击下一步,直到安装完毕 ...
- Spring 和整个体系 @Value注解 配合属性文件.property
未来学习方向 重要思路 学的时候看官方文档,系统地学,比如学Spring Boot ,但真正使用的时候,有比自动化(条件化)配置,约定即配置 更好的方法(这个可读性不强,对电脑来说它执行的代码一样 ...
- keepalived+lvs简单实现
一,部署实战环节 01,服务架构图: 服务器镜像为centos6.9 02,服务安装: 10.0.0.10: 下载keeplived官方包--> http://www.keepalived. ...
- linux运维基础之系统挂载与etc文件下介绍
1) 目录结构说明: windows:磁盘----分区---格式化--系统 linux:磁盘--分区--生成一个文件(磁盘分区) linux 中一切皆文件 ll -h 显示人类能看懂的 mount - ...
- mathjs使用指南
1.安装 npm install mathjs 2.引入 import * as math from "mathjs" 3.使用方法 函数调用法:math.add(math.sqr ...