select u.money_remain,
ba.price,ba.total_count,
ba.total_price,
bc.company_name,
bc.total_balance
from users u , boss_customer bc, boss_addmoney ba
where bc.belong_sales = 'jijun' and u.user_id = bc.user_id and u.username = ba.name
group by u.username
order by ba.name,ba.add_date
这样group 出来的第一条充值记录哦!
巧用group by 和 order by,可以很快速的查询我想要的数据。还有在mysql里面使用in(),效率很慢。