用户列表-投资记录sql
--普通标、定向标、新手标、老互融计划-投资记录表
select bid.borrow_id,
(select yyb.borrow_valid_time from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id ) as borrow_valid_time,
(select yyb.borrow_end_time from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id ) as borrow_end_time,
(select yyb.BidComRate from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id ) as BidComRate,
(select yyb.Title from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id ) as Title,
bid.amount as amount,
(select yyb.BorrowCode from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id) as BorrowCode,
(select yyb.borrow_period from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id) as borrow_period,
(select yyb.status from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id) as statuss,
bid.createtime as createtime,
--(select DATEADD(MONTH,yyb.borrow_period,yyb.loanDate) from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id ) as endDate
(
select case when yyb.loanDate='1900-01-01 00:00:00.000' then '1900-01-01 00:00:00.000' else
DATEADD(MONTH,yyb.borrow_period,yyb.loanDate) end
from YYD_Borrow_BorrowInfo as yyb where yyb.ID=bid.borrow_id
) as endDate
from YYD_Borrow_BidRecord as bid inner join YYD_Borrow_borrowinfo_ext as ext on bid.borrow_id = ext.borrow_id where ext.borrow_product<>50 and ext.borrow_product<>70 and bid.bid_user_id=1239
union all
--新互融计划投资记录表
select newbid.nplid,'' as borrow_valid_time,'' as borrow_end_time,'' as BidComRate,
(select bTitle+'['+qishu+']' from HUR_NewPlanLoan where id=newbid.nplid)Title,
newbid.amount as amount,'' as BorrowCode,
(select bPeriod from HUR_NewPlanLoan where id=newbid.nplid)borrow_period,
newbid.nplStatus as statuss,newbid.createtime as createtime,
(select case when yyb.loanDate='1900-01-01 00:00:00.000' then '1900-01-01 00:00:00.000' else
DATEADD(MONTH,loan.bPeriod,yyb.loanDate) end from YYD_Borrow_BorrowInfo as yyb,HUR_NewPlanLoan as loan
where yyb.id in (select top 1 borrowId from HUR_NewPlanLoan_ItemLoan as item
where item.nplBid = newbid.id) and loan.id = newbid.nplid) as endDate
from HUR_NewPlanLoan_BidRecord as newbid where newbid.nplStatus=1 and newbid.userid=1337
union all
----个人债权转让的投资记录表
select bid.borrow_id,
(select yyb.borrow_valid_time from YYD_Borrow_BorrowInfo as yyb where yyb.ID=(
select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_id=bid.borrow_id)) as borrow_valid_time,
(select yyb.borrow_end_time from YYD_Borrow_BorrowInfo as yyb where yyb.ID=(
select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_id=bid.borrow_id)) as borrow_end_time,
(select yyb.BidComRate from YYD_Borrow_BorrowInfo as yyb where yyb.ID=(
select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_id=bid.borrow_id)) as BidComRate,
(select yyb.Title from YYD_Borrow_BorrowInfo as yyb where yyb.id =(
select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_id=bid.borrow_id)) as Title,
bid.amount as amount,
(select yyb.BorrowCode from YYD_Borrow_BorrowInfo as yyb where yyb.id =(
select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_id=bid.borrow_id)) as BorrowCode,
(select yyb.borrow_period from YYD_Borrow_BorrowInfo as yyb where yyb.id =(
select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_id=bid.borrow_id)) as borrow_period,
(select yyb.status from YYD_Borrow_BorrowInfo as yyb where yyb.id =(
select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_id=bid.borrow_id)) as statuss,
bid.createtime as createtime,
--(select DATEADD(MONTH,yyb.borrow_period,yyb.loanDate) from YYD_Borrow_BorrowInfo as yyb where id =(
--select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_id=bid.borrow_id)) as endDate
(select case when yyb.loanDate='1900-01-01 00:00:00.000' then '1900-01-01 00:00:00.000' else
DATEADD(MONTH,yyb.borrow_period,yyb.loanDate) end
from YYD_Borrow_BorrowInfo as yyb where yyb.id =(select top 1 ext.OrginBorrowId from YYD_Borrow_borrowinfo_ext as ext
where ext.borrow_id=bid.borrow_id)) as endDate
from YYD_Borrow_BidRecord as bid inner join YYD_Borrow_borrowinfo_ext as ext on bid.borrow_id = ext.borrow_id
where ext.borrow_product=50 and bid.bid_user_id=1239
用户列表-投资记录sql的更多相关文章
- 使用mybatis提供的各种标签方法实现动态拼接Sql。这里演示where标签和if标签实现使用姓名的模糊查询和性别查询用户列表,当用户没有选择姓名以及性别时查询出所有的记录。
1.需求: 使用姓名的模糊查询和性别查询用户列表,当用户没有选择姓名以及性别时查询出所有的记录. 2.在UserMapper接口中定义方法: public List<User> findU ...
- SQL练习题_用户购买收藏记录合并(拼多多)
目录 拼多多笔试题0805_统计用户数据 笔试题描述 表格构建 数据观察 题目分析 一.合并表格 二.CASE表示(0,1) 三.同理复制FORK表 题目解答 拼多多笔试题0805_统计用户数据 笔试 ...
- sql -- 获取连续签到的用户列表
签到表: 需求:统计连续签到的 用户 1.根据用户和日期分组 select user_name, sign_date from user_sign group by user_name, sign_d ...
- C#开发微信门户及应用(4)--关注用户列表及详细信息管理
在上个月的对C#开发微信门户及应用做了介绍,写过了几篇的随笔进行分享,由于时间关系,间隔了一段时间没有继续写这个系列的博客了,并不是对这个方面停止了研究,而是继续深入探索这方面的技术,为了更好的应用起 ...
- 记录SQL Server2008日志文件损坏的恢复过程
记录SQL Server2008日志文件损坏的恢复过程: 环境: 系 统:Windows Server2003 数据库:SQL Server2008 故障原因: 通过mstsc链接同一服务器时,用户界 ...
- 在MySQL中使用init-connect与binlog来实现用户操作追踪记录
在MySQL中使用init-connect与binlog来实现用户操作追踪记录 分类: MySQL 前言: 测试环境莫名其妙有几条重要数据被删除了,由于在binlog里面只看到是公用账号删除的,无法查 ...
- Android 实现用户列表信息的功能,然后选择删除幻灯片删除功能
在项目开发过程中.经常须要对用户列表的信息进行删除的操作.Android中经常使用的删除操作方式有两种 .一种就是类似微信的滑动出现删除button方式,另一种是通过CheckBox进行选择.然后通过 ...
- 基于Redis的在线用户列表解决方案
前言: 由于项目需求,需要在集群环境下实现在线用户列表的功能,并依靠在线列表实现用户单一登陆(同一账户只能一处登陆)功能: 在单机环境下,在线列表的实现方案可以采用SessionListener来完成 ...
- [项目回顾]基于Redis的在线用户列表解决方案
迁移:基于Redis的在线用户列表解决方案 前言: 由于项目需求,需要在集群环境下实现在线用户列表的功能,并依靠在线列表实现用户单一登陆(同一账户只能一处登陆)功能: 在单机环境下,在线列表的实现方案 ...
随机推荐
- c trans
#define BUFSIZE 100 char buf[BUFSIZE]; ; int getch(void) { )? buf[--bufp] : getchar(); } void ungetc ...
- c#获取url请求的返回值(转)
有两种方式获取. 方法一: /// <summary> /// 获取url的返回值 /// </summary> /// <param name="url&qu ...
- Round robin
http://www.computerhope.com/jargon/r/rounrobi.htm Round robin Round robin is a method of distributin ...
- Android版本升级同时Sqlite数据库的升级及之前数据的保留
http://www.cnblogs.com/wang340/archive/2013/05/06/3063135.html http://www.eoeandroid.com/forum.php?m ...
- tabhost切换标签:Log中出现You must supply a layout_width attribute的解决方法
谷歌.百度该问题,发现,除非是真的忘记添加layout_height或者layout_width属性值,对于布局文件没有语法问题但又难以发现问题所在的情况,从自己的经历和一个帖子的说明看到,该错误多半 ...
- Unity3D中目标相对自身的前后左右方位判断
http://blog.csdn.net/cen616899547/article/details/38336185 在做rpg类游戏的过程中,经常遇到要判断周围怪物相对自身的方位 1.判断目标在 ...
- astyle 使用说明
欢迎关注我的社交账号: 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://github.com/jiangxincode 知乎地址 ...
- Mybatis学习(壹)
一.Mybatis的引言 1.Mybatis框架概念:是数据库持久层的框架,对数据库的访问和操作.Mybatis对JDBC的封装,Mybatis替换JDBC开发,解决DAO中的通用问题. 2.JDBC ...
- Azure平台 对Twitter 推文关键字进行实时大数据分析
Learn how to do real-time sentiment analysis of big data using HBase in an HDInsight (Hadoop) cluste ...
- js中event.target,this
event.target这是注册事件时的对象,或者它的子元素.通常用于比较 event.target 和 this 来确定事件是不是由于冒泡而触发的.经常用于事件冒泡时处理事件委托. 1.this和e ...