标签:
--投资情况统计详情sql
select BidRecord.*, RegInfo.UserName,UserInfo.phone,BorrowInfo.Title,BorrowInfo.BorrowCode from
--(select * from [YYD_Account_MoneyRecord] where moneytype=‘参与投标‘ and state=1) as MoneyRecord
(select * from YYD_Borrow_BidRecord where status=1 and
borrow_id in(select borrow_id from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_product<>50)) as BidRecord
left join
(select * from YYD_Users_RegInfo) as RegInfo
on BidRecord.bid_user_id=RegInfo.ID
left join
(select * from YYD_Users_UserInfo) as UserInfo
on BidRecord.bid_user_id=UserInfo.user_id
left join
(select * from YYD_Borrow_BorrowInfo) as BorrowInfo
on BidRecord.borrow_id= BorrowInfo.ID
where Convert(varchar(10),BidRecord.createtime,120)=‘2016-07-11‘
and (BorrowInfo.Title like ‘%%‘ or BorrowInfo.BorrowCode like ‘%%‘)
union
select BidRecord.*, RegInfo.UserName,UserInfo.phone,BorrowInfo.bTitle+‘[‘+BorrowInfo.qishu+‘]‘,‘‘ from
--(select * from [YYD_Account_MoneyRecord] where moneytype =‘加入计划‘ and state=1) as MoneyRecord
(select * from YYD_Borrow_BidRecord where status=1 and
borrow_id in(select borrow_id from YYD_Borrow_borrowinfo_ext as ext where ext.borrow_product<>50)) as BidRecord
left join
(select * from YYD_Users_RegInfo) as RegInfo
on BidRecord.bid_user_id=RegInfo.ID
left join
(select * from YYD_Users_UserInfo) as UserInfo
on BidRecord.bid_user_id=UserInfo.user_id
left join
(select * from HUR_NewPlanLoan) as BorrowInfo
on BidRecord.borrow_id= BorrowInfo.ID
where Convert(varchar(10),BidRecord.createtime,120)=‘2016-07-11‘
and (BorrowInfo.bTitle+‘[‘+BorrowInfo.qishu+‘]‘ like ‘%%‘)
order by createtime desc
标签:
原文地址:http://www.cnblogs.com/zxtceq/p/5703750.html