table:log_create_player
player_id uid created_time
1 11 121221
2 22 121212
table:log_login
player_id action_time
1 22323
1 33434
table:payment
pay_user_id pay_amount exchage
22 33 0.333
想得到
player_id max(action_time) times doll
1 33434 2 9.999
SQL語句:
DB::connection($this->db_name)->select("select lcp.player_id,lcp.player_name,from_unixtime(created_time),from_unixtime(max(action_time)),count(1) as times, sum(o.pay_amount*o.exchange) from log_create_player lcp join log_login ll on lcp.player_id=ll.player_id left join {$this->db_payment}
.pay_order o on lcp.uid = o.pay_user_id where created_time between {$start_time} and {$end_time} and o.get_payment = 1 group by player_id having max(action_time)<{$interval}");
為什麼最後的出來的是空????
http://blog.csdn.net/dxnn520/article/details/8281467