SQL查询数据练习(2019上半年金融服务申请数据统计)

1.记录意向且拍卖成交的数据:

select row_number() over(order by LoanPreApply.CreateDate asc) as 序号,LoanPreApply.Proposer as ‘中标者‘,LoanPreApply.BidderNo as ‘中标号‘,LoanBank.BankName as ‘申请银行‘, LoanPreApply.CreateDate as ‘申请时间‘ from LoanPreApply,LoanBank where  LoanPreApply.BankId=LoanBank.BankId and LoanPreApply.CreateDate>‘2019-01-01‘ and  LoanPreApply.CreateDate<‘2019-07-01‘

2.支付后分期柜面申请数据:

select row_number() over(order by LoanApply.ApplyTime asc) as 序号,LoanApply.Proposer as ‘中标者‘,LoanApply.BidderNo as ‘中标号‘,LoanBank.BankName as ‘申请银行‘, LoanApply.ApplyTime as ‘申请时间‘ from LoanApply,LoanBank where  LoanApply.BankId=LoanBank.BankId and LoanApply.ApplyType=1 and LoanApply.BusinessType=1 and  LoanApply.ApplyTime>‘2019-01-01‘ and  LoanApply.ApplyTime<‘2019-07-01‘

3.所有申请表

select row_number() over(order by LoanApply.ApplyTime asc) as 序号,LoanApply.Proposer as ‘中标者‘,LoanApply.BidderNo  as ‘中标号‘,LoanBank.BankName as ‘申请银行‘,(case LoanApply.AcceptStatus when 1 then ‘已受理‘ else ‘未受理‘ end) as ‘受理状态‘,(case LoanApply.CheckStatus when 1 then ‘已通过‘ else ‘未通过‘ end) as ‘通过状态‘,(case LoanApply.PaymentStatus when 1 then ‘已打款‘ else ‘未打款‘ end) as ‘打款状态‘,(case LoanApply.MoneyCheckStatus when 1 then ‘已核账‘ else ‘未核账‘ end) as ‘核账状态‘,LoanApply.ApplyTime as ‘申请时间‘ from LoanApply,LoanBank where  LoanApply.BankId=LoanBank.BankId and  LoanApply.ApplyTime>‘2019-01-01‘ and  LoanApply.ApplyTime<‘2019-07-01‘ 

原文地址:https://www.cnblogs.com/yechangzhong-826217795/p/11127081.html

时间: 2024-10-08 11:14:20

SQL查询数据练习(2019上半年金融服务申请数据统计)的相关文章

用sql查询当天,一周,一个月的数据

数据查询,不管在网站还是在系统,都很常见,下文是介绍最常见的以日期查询的语句 select * from ShopOrder where datediff(week,ordTime,getdate()-1)=0   //查询当天日期在一周年的数据 select * from ShopOrder where datediff(day,ordTime,getdate()-1)=0   //查询当天的所有数据 --查询当天: select * from info where DateDiff(dd,d

sql 查询表格中多列重复的数据并显示该表的其他列

我们一般情况下通过分组函数group by来查询重复的列 SELECT [column1],[column2] FROM [dbo].[Table] where 1=1) R group by [column1],[column2] having count(*) > 1 但是查询出的结果不能显示该表的其他列 想要查询一张表中有多个列重复的数据且也要显示该表的其他列 SELECT M.* FROM [dbo].[Table] M, (SELECT * FROM (SELECT [column1]

sql 查询最近30分钟或者自定义时间数据

SELECT sysdate,sysdate-30/(24*60) FROM dual; 30分钟或者自定义

sql 查询一段时间内某个时间点数据

SELECT  CONVERT(VARCHAR(10), dtCreateTime, 120) AS dtStatisticsCreateDate, COUNT(1) AS nStatisticsCount                    FROM    Web_Statistics                    WHERE datepart(hh,dtCreateTime)>=10 AND datepart(hh,dtCreateTime)<11

SQL查询语句 [2]

一.快捷查询 快捷查询方式是一种多字段查询的简化写法,在多个字段之间用'|'隔开表示OR,用'&'隔开表示 AND. 1.不同字段相同查询条件 在  Home/controller/UserController.class.php   中插入 //使用相同查询条件 $user = M('User'); $map['user|email'] = '蜡笔小新'; //'|'换成'&'变成AND var_dump($user->where($map)->select()); 这时在浏

SQL查询(笔记2——实体查询)

SQL查询(笔记2——实体查询) 二.实体查询 如果查询返回了某个数据表的全部数据列,且该数据表有对应的持久化类映射,我们就把查询结果转换成实体查询.将查询结果转换成实体,可以使用SQLQuery提供的多个重载addEntity()方法. String sqlString = "select * from enrolment where year=:year"; List l = session.createSQLQuery (sqlString) //指定查询的记录行转换成Enrol

将Sql查询语句获取的数据插入到List列表里面

Sql查询语句获取的数据是分格式的,我们还用SqlDataReader来做,然后用IDataReader来接收读取,以下是代码: //我想查询一个用户表的信息,该用户有姓名,密码,信息三列 //1.定义一个用户类型的List数组,userInfo类的代码在下方 List<userInfo> userInfo = new List<userInfo>(); //2.我们要读取查询语句的数据,并且保存了.这里我们将使用IDataReader语句 //数据库类的实例,类的代码在下方 DB

SQL学习_查询重复数据和连接多个表数据的方法

进行数据库测试时需要根据不同场景查询数据,以便验证发现的问题是否为脏数据引起的.记录一下最近常用的查询方法: 1. 查询表中重复数据(id不同,多个字段值相同) select P1.* from project as P1, project as P2 where P1.id<>P2.id and P1.ProjectId=P2.ProjectId and P1.ServiceTypeId=P2.ServiceTypeId and P1.Rank=P2.Rank 2.连接多个表数据 selec

循环查询sql带逗号(,)分隔的数据

? 1 2 3 4 5 6 select * from sys_role_list where id in (select c from (with test as (select roleid c from sys_role_info where id=1) select substr(t.ca,instr(t.ca, ',', 1, c.lv) + 1,instr(t.ca, ',', 1, c.lv + 1) - (instr(t.ca, ',', 1, c.lv) + 1)) AS c