--普通标、定向标、新手标、老互融计划-投资记录表
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相关推荐

  1. sql语句筛选一个月内生日的用户列表

    查询一个月内的过生日的用户列表 思路: 生日每年都有对应的一天,所以需要筛选的时候不能加上年 只能用 "月-日" 作为筛选条件 用 DATE_ADD(now(),interval ...

  2. 如何记录SQL Server数据库对象

    介绍 (Introduction) In any good programming reference, you will read that a developer has to document ...

  3. Java学习日志Day41_过滤器Filter 接口_项目更新:后台管理/前台统一处理全局乱码and用户列表---删除以及分页功能

    一.过滤器Filter 接口 1.导包: <groupId>com.qf</groupId> <artifactId>FilterAndJquery</art ...

  4. (转)C#开发微信门户及应用(4)--关注用户列表及详细信息管理

    http://www.cnblogs.com/wuhuacong/p/3695213.html 在上个月的对C#开发微信门户及应用做了介绍,写过了几篇的随笔进行分享,由于时间关系,间隔了一段时间没有继 ...

  5. Cookie获取用户的访问记录

    使用Cookie技术  获取用户的访问记录 1.创建 虚拟数据 package com.oracleoaec.cookie;import java.util.HashMap;public class ...

  6. linux编程参数列表,Linux编程 14 文件权限(用户列表passwd,用户控制shadow,useradd模板与useradd命令参数介绍)...

    一. 概述 linux安全系统的核心是用户账户. 创建用户时会分配用户ID(UID). UID是唯一的,但在登录系统时不是用UID,而是用登录名.在讲文件权限之之前,先了解下linux是怎样处理用户账 ...

  7. 用户列表 java_三个jsp页面+Java片段实现的用户登录和用户列表查询[带分页]

    和Servlet功能需求一样 数据库: CREATE DATABASE user; USE user; CREATE TABLE `user` ( `userId` int(11) NOT NULL ...

  8. 在单用户模式下启动SQL Server的不同方法

    In this article, we will review different ways to start SQL Server in single user mode. 在本文中,我们将介绍在单 ...

  9. 转载--SQL还原数据库后孤立用户问题处理(SQL 数据库 拥有对象 无法删除)

    SQL还原数据库后孤立用户问题处理(SQL 数据库 拥有对象 无法删除) 所谓孤立帐户,就是某个数据库的帐户只有用户名而没有登录名,这样的用户在用户库的sysusers系统表中存在,而在master数 ...

最新文章

  1. python基础实例-Python 练习实例14
  2. 人脸识别大规模爆发!
  3. 预祝大家2011农历新年快乐,宏“兔”大展,心想事成~
  4. Caused by: javax.xml.stream.FactoryConfigurationError: Provider com.ctc.wstx.stax.WstxInputFactory n
  5. Select2的使用 联动筛选框的一个例子
  6. 20200705:力扣196周周赛上
  7. Otto开发初探——微服务依赖管理新利器
  8. Linux查看端口占用进程
  9. 【转】Windows Phone在隔离存储里存取图片文件
  10. MySQL 安装及配置 Navicat 工具
  11. mysql通配符_MySQL中的通配符
  12. 大学计算机基础贾宗璞答案,大学计算机应用基础C教学大纲
  13. linux proftpd 用户,proftpd 虚拟帐号的建立及quota
  14. 逆向教程-2014.08版电信爱游戏支付分析
  15. 曼尼托巴大学计算机科学硕士,曼尼托巴大学计算机科学本科申请.pdf
  16. //12、设计人民币类,其数据成员为fen(分)、jiao(角)、yuan(元)。重载这个类的加法、减法运算符,并给出主函数应用该类。
  17. java core 正则 \\PL+的意义
  18. H3C无线接入器WA4320-ACN-SI之FIT转FAT(瘦版本转胖版本)
  19. Jmeter多用户并发性能测试操作步骤
  20. 在手机中实现高保真音频

热门文章

  1. 这玩意比ThreadLocal叼多了,吓得我赶紧分享出来。
  2. 短信验证码的登录流程
  3. 如何设计并实现一个秒杀系统?(含完整代码)
  4. CMU赵越:关于数据挖掘的分享!
  5. ​【特征工程】时序特征挖掘的奇技淫巧
  6. 你有哪些 Deep learning(RNN、CNN)调参的经验?
  7. 年薪 50w,这门编程语言该怎么学?
  8. Hinton新论文:如何在神经网络中表示“部分-整体层次结构”?
  9. 拼手速抢红包!送大家现金红包!
  10. 沈向洋博士:三十年科研路,我踩过的那些坑