0
다음과 같은 쿼리가 있습니다.MySQL 한계가 특정 범위로 설정되지 않음
$tests = DB::select('devices.id')
->select(array('devices.description', 'dev_desc'))
->select(array('device_types.description', 'devtype_init'))
->select(array('actions.description', 'test_desc'))
->select(array('history.dt_logged', 'last_test'))
->select(array(DB::expr('history.dt_logged + (devices.frequency * 7 * 24 * 60 * 60)'), 'next_test'))
->from('history')
->join('actions')->on('history.action_id', '=', 'actions.id')
->join('devices')->on('history.device_id', '=', 'devices.id')
->join('device_types')->on('devices.device_type_id', '=', 'cal_device_types.id')
->and_where(DB::expr('history.dt_logged + (devices.frequency * 7 * 24 * 60 * 60)'), '>=', $start)
->and_where(DB::expr('history.dt_logged + (devices.frequency * 7 * 24 * 60 * 60)'), '<=', $end)
->where('device_types.description', '=', 'Calibration')
->order_by('history.dt_logged', 'desc')->limit(1)
->execute();
나는 다시 하나 개의 레코드를 끌어 할 따라서 "제한 (1)"하지만 여러 레코드를 다시 가져옵니다. 이 코드는 나에게 완벽 해 보인다. 어떤 도움이라도 대단히 감사하겠습니다.
건배.
상관 관계가있는 하위 쿼리가 작동합니까?