循环查询问题
我需要连接四张表,
select o.orderId,u.nickName,o.serveCount,(select u.nickName from user u where u.shortUrl=o.shortUrlServer) nname ,
(select ((count(*) * (total - counterFee))*0.03)) b,-- f交易奖励
(select (count(*) * (total - counterFee))) a,-- 服务费
(SELECT (total - counterFee)) c,e.evaTextContent,e.evaLevle
from user u
INNER JOIN orders o on o.shortUrlUser = u.shortUrl
left JOIN serve s ON o.serveId=s.serveId
LEFT JOIN evaluate e on e.orderId=o.orderId;
现在想取到每一个人(nname)的订单的唯一值,就是统计每一个人的serveCount,这个怎么实现循环查询