从 phpmyadmin 运行时,以下查询按预期返回一行。
SELECT units . * , locations . *
FROM units, locations
WHERE units.id = '1'
AND units.location_id = locations.id
LIMIT 0 , 30
但是当我尝试在 Kohana 3 中这样做时:
$unit = DB::select('units.*', 'locations.*')
->from('units', 'locations')
->where('units.id', '=', $id)->and_where('units.location_id', '=', 'locations.id')
->execute()->as_array();
var_dump($unit);
它打印
数组(0){}
我究竟做错了什么?