2017-06-19 57 views
-2

如何把這個標準的sql到laravel 5.3查詢?如何把這個標準的sql到laravel查詢?

SELECT a.emp_id, d.course_code, d.start_time, d.end_time, 
(SELECT time FROM hris_biometrics_attendance WHERE date = '2017-06-13' AND time BETWEEN d.start_time - 1 AND d.end_time -1 AND emp_id = a.emp_id) AS time_in, 
(SELECT time FROM hris_biometrics_attendance WHERE date = '2017-06-13' AND time BETWEEN d.end_time - 1 AND d.end_time + 1 AND emp_id = a.emp_id) AS time_out FROM hris_ftl_final_courses a, hris_ftl_final_courses_details d 

回答

0

$ sql = your query; 返回DB :: select($ sql);