total_time_driven_at_this_trip
için en yüksek değere sahip benzersiz kullanıcı kimliğini almak ve user_name
'u user_id
numaralı ilişkiye ait olan başka bir tablodan almak için DISTINCT
'u nasıl kullanırım? Cakephp DISTINCT
Bu çalıştı
...$this->set('tripNsws', $this->TripNsw->find('all',array('limit' => 20,'fields' => array('DISTINCT(TripNsw.user_id)','TripNsw.total_time_driven_at_this_trip'),'group' => array('TripNsw.user_id') ,'order' => array('TripNsw.total_time_driven_at_this_trip desc'))));
ama işe yaramıyor. Doğru kesişimi olan
SELECT DISTINCT(user_id),`total_time_driven_at_this_trip` FROM `trip_nsws` order by `total_time_driven_at_this_trip` desc
- hiç – mark