概述
oracle 查询的时候加条件判断
方法一.
select a.idcard,
SUM(
CASE WHEN a.subject_code=2 THEN a.SCOPE ELSE 0 END
)
,
SUM(
CASE WHEN a.subject_code=3 THEN a.SCOPE ELSE 0 END
)
,
SUM(
CASE WHEN a.subject_code=4 THEN a.SCOPE ELSE 0 END
)
,
SUM(
CASE WHEN a.subject_code=5 THEN a.SCOPE ELSE 0 END
)
from cm_student_score a
GROUP BY a. idcard
注:使用方法
SUM(
CASE WHEN a.subject_code=2 THEN a.SCOPE ELSE 0 END
)
如果a.subject_code=2则值为a.SCOPE,否则为0
而SUM()这方法是,把里面所有的成绩全部加起来.意思:所有subject_code=2的总成绩
方法二:
SELECT a.idcard,sum(DECODE(subject_code,2,SCOPE,0)) subject_code2,
sum(DECODE(subject_code,2,SCOPE,0)) subject_code3,
sum(DECODE(subject_code,2,SCOPE,0)) subject_code4,
sum(DECODE(subject_code,2,SCOPE,0)) subject_code5
from cm_student_score GROUP BY a. idcard
相关文档:
1import java.sql.*;
2import java.util.logging.Level;
3import java.util.logging.Logger;
4
5/** *//**
6 * Title: JDBC连接数据库
7 * Description: 本实例演示如何使用JDBC连接Oracle数据库,并演示添加数据和查询数据.
8 */
9public class JDBCExampl ......
Exam Number/Code : 1Z0-053
Exam Name : Oracle Database 11g: Administration II
Questions and Answers : 167 Q&As
Update Time: 2010-05-15
1. You are not sure if Flashback Database is enabled. What database column and view can you query to
see if the flashback logs are being created in the ......
1、 停止oracle所有的服务(开始--运行--输入services.msc)
2、 删除注册表上的ORACLE的有关键值(开始-->运行-->输入regedit)将HKEY_LOACAL_MACHINE/SOFTWARE下的主键ORACLE全部删除。
3. 下面删除Oracle服务:进入HKEY_LOACAL_MACHINE/SYSTEM主键下,在ControlSet001、ControlSet002、CurrentControlSet--> ......
虽然这是我找到最详细的配置描述,但是尝试还是没有成功。
1.下载Oracle Client Package
.
从
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
下载
Instant
Client Package – Basic
包
(
标注
:All files
required to run OCI, OCCI, and JDBC-OC ......
虽然这是我找到最详细的配置描述,但是尝试还是没有成功。
1.下载Oracle Client Package
.
从
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
下载
Instant
Client Package – Basic
包
(
标注
:All files
required to run OCI, OCCI, and JDBC-OC ......
最后
以上就是陶醉凉面为你收集整理的oracle 里面加条件判断,oracle 查询的时候加条件判断的全部内容,希望文章能够帮你解决oracle 里面加条件判断,oracle 查询的时候加条件判断所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复