php - CodeIgniter how to sort joined record -


i have following query in codeigniter:

$user = $this->db     ->select('users.*, login_logs.ip_address, login_logs.date, login_logs.userid')     ->from('db.users')     ->join('db.login_logs', 'users.userid = login_logs.userid')     ->group_by('users.userid')     ->get()     ->result_array(); 

it works have select last record each user( in login_logs table) i'm getting first record. have tried :

->order_by('login_logs.idlogin_logs', 'desc') 

but didn't work.

i have no idea how it. there easy way reach it?

@edit

i have triend asc/desc. no changes.

present query:

 select `users`.*, `login_logs`.`ip_address`, `login_logs`.`date`, `login_logs`.`userid` `db`.`users` join `db`.`login_logs` on `users`.`userid` = `login_logs`.`userid` group `users`.`userid`   


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -