Я пытаюсь преобразовать следующий запрос SQL в формат Codeigniter.
SELECT tb.pickup_trip_location,
tb.drop_trip_location,
CONCAT_WS(' ', tp.firstname, tp.lastname) AS passenger_name,
tb.tkt_passenger_id_no AS tkt_passenger_id_no,
tb.trip_id_no AS trip_id_no,
tb.id_no AS booking_id_no,
DATE_FORMAT(tb.booking_date, '%m/%d/%Y %h:%i %p') as booking_date,
DATE_FORMAT(tb.date, '%b %e %Y %T') as booking_time,
tr.name AS route_name,
tb.request_facilities AS request_facilities,
tb.price AS price,
tb.total_seat AS quantity,
tb.discount AS discount,
tb.seat_numbers AS seat_serial,
tb.adult,
tb.child,
tb.special,
tb.booking_type,
tb.trip_route_id,
tp.nid,
tp.phone AS phone,
tb.payment_status,
fr.owner,
fr.reg_no,
tras.`assign_time` AS assign_time
from tkt_booking AS tb
join tkt_passenger AS tp ON tb.tkt_passenger_id_no = tp.id_no
join trip_route AS tr ON tr.id = tb.trip_route_id
join trip_assign AS tras ON tras.trip = tb.trip_id_no
join fleet_registration AS fr ON fr.id = tb.fleet_id
where tb.id_no = "$booking_id_no" AND
DATE(tb.booking_date) = DATE(tras.`assign_time`)
Мне удалось написать следующий код, но он не возвращает никаких данных
return $this->db->select("
tb.pickup_trip_location,
tb.drop_trip_location,
CONCAT_WS(' ', tp.firstname, tp.lastname) AS passenger_name,
tb.tkt_passenger_id_no AS tkt_passenger_id_no,
tb.trip_id_no AS trip_id_no,
tb.id_no AS booking_id_no,
DATE_FORMAT(tb.booking_date, '%m/%d/%Y %h:%i %p') as booking_date,
DATE_FORMAT(tb.date, '%b %e %Y %T') as booking_time,
tr.name AS route_name,
tb.request_facilities AS request_facilities,
tb.price AS price,
tb.total_seat AS quantity,
tb.discount AS discount,
tb.seat_numbers AS seat_serial,
tb.adult,
tb.child,
tb.special,
tb.booking_type,
tb.trip_route_id,
tp.nid,
tp.phone AS phone,
tb.payment_status,
fr.owner,
fr.reg_no,
tras.`assign_time` AS assign_time
")
->from('tkt_booking AS tb')
->join('tkt_passenger AS tp', 'tb.tkt_passenger_id_no = tp.id_no' ,'full')
->join('trip_route AS tr', 'tr.id = tb.trip_route_id','full')
->join('trip_assign AS tras', 'tras.trip = tb.trip_id_no','full')
->join('fleet_registration AS fr', 'fr.id = tb.fleet_id','full')
->where('tb.id_no', $booking_id_no)
->where(DATE(tb.booking_date),DATE(tras.assign_time))
->get()
->row();
Проблема заключается в следующей строке -> где (Dat (tb.booking_date), DATE (tras.assign_time)), потому что, когда я закомментировал это, я получил некоторые данные
Пожалуйста, ПОМОГИТЕ