mysql 链表查询,设置参数查询

set @a=to_days(now());
select d.UserID,d.OrderID,d.ProductID,sum(PayMoney) as PayMoney,Count(*) as PayCount,RealName,Phone,o.OrderMoney,o.OrderNo,o.OrderDate,b.BankName,b.BankAddress,b.CardNo,max(d.PayTime) as Times ,p.ProductName
from InvestOrderDetail d
left join UserInfo u on d.UserID=u.UserID
left join InvestOrder o on d.OrderID=o.OrderID
left join InvestProduct p on d.ProductID=p.ProductID
left join UserBank b on d.UserID=b.UserID and b.IsDefault=1
where  to_days(d.PayTime)=@a GROUP BY d.UserID,d.OrderID,d.ProductID

 

posted @ 2017-01-18 09:38  前行。。。  阅读(1235)  评论(0编辑  收藏  举报