Time : 13:04:04 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY distance ASC LIMIT 1' at line 55 Raw SQL : SELECT h.*, ( 111.111 * DEGREES( acos( cos(radians(31.1075588)) * cos(radians(h.latitude)) * cos(radians(h.longitude) - radians(77.1959622)) + sin(radians(31.1075588)) * sin(radians(h.latitude)) ) ) ) AS distance FROM rt_service_providers h WHERE h.status = 1 AND (FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1' OR FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1') AND h.amount > 0 -- Allowed categories AND ( FIND_IN_SET(1, h.category_id) OR FIND_IN_SET(20, h.category_id) OR FIND_IN_SET(8, h.category_id) OR FIND_IN_SET(17, h.category_id) OR FIND_IN_SET(2, h.category_id) ) -- 1️⃣ Provider not accepted/started any booking today AND h.id NOT IN ( SELECT DISTINCT provider_id FROM rt_booking_on_the_go WHERE DATE(date_time) = CURDATE() AND booking_status IN ('Accepted', 'Started') ) -- 2️⃣ Exclude providers already pre-assigned for active bookings AND h.id NOT IN ( SELECT pah.provider_id FROM pre_assigned_helper pah JOIN rt_booking_on_the_go b ON b.booking_app_id = pah.booking_app_id WHERE b.booking_status IN ('Requested', 'Schedule') ) -- Provider Activity Filters AND h.deactivate_account = 0 AND h.last_seen >= NOW() - INTERVAL 96 HOUR AND h.latitude IS NOT NULL AND h.longitude IS NOT NULL AND h.category_id <> '' AND h.last_seen IS NOT NULL HAVING distance <= ORDER BY distance ASC LIMIT 1 Time : 13:03:19 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'b.booking_status' in 'where clause' Raw SQL : SELECT *, (111.111 * DEGREES(acos(cos(radians(31.1075588)) * cos(radians(latitude)) * cos(radians(longitude) - radians(77.1959622)) + sin (radians(31.1075588)) * sin(radians(latitude)) ))) AS distance from rt_service_providers where status = 1 and (FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1' OR FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1') and amount > 0 and (FIND_IN_SET(1, category_id) OR FIND_IN_SET(20, category_id) OR FIND_IN_SET(8, category_id) OR FIND_IN_SET(17, category_id) OR FIND_IN_SET(2, category_id) ) AND id NOT IN ( SELECT DISTINCT provider_id FROM rt_booking_on_the_go WHERE DATE(date_time) = CURDATE() AND b.booking_status IN ('Accepted', 'Started') ) -- 2️⃣ Do not select providers who are already pre-assigned AND id NOT IN ( SELECT pah.provider_id FROM pre_assigned_helper pah JOIN rt_booking_on_the_go b ON b.booking_app_id = pah.booking_app_id WHERE booking_status IN ('Requested', 'Schedule') ) and deactivate_account = 0 and last_seen >= NOW() - INTERVAL 96 HOUR and latitude IS NOT NULL and longitude IS NOT NULL and category_id <> '' and last_seen IS NOT NULL ORDER BY distance ASC LIMIT 1 Time : 13:02:21 SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'booking_app_id' in on clause is ambiguous Raw SQL : SELECT *, (111.111 * DEGREES(acos(cos(radians(31.1075588)) * cos(radians(latitude)) * cos(radians(longitude) - radians(77.1959622)) + sin (radians(31.1075588)) * sin(radians(latitude)) ))) AS distance from rt_service_providers where status = 1 and (FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1' OR FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1') and amount > 0 and (FIND_IN_SET(1, category_id) OR FIND_IN_SET(20, category_id) OR FIND_IN_SET(8, category_id) OR FIND_IN_SET(17, category_id) OR FIND_IN_SET(2, category_id) ) AND id NOT IN ( SELECT DISTINCT provider_id FROM rt_booking_on_the_go WHERE DATE(date_time) = CURDATE() AND booking_status IN ('Accepted', 'Started') ) -- 2️⃣ Do not select providers who are already pre-assigned AND id NOT IN ( SELECT pah.provider_id FROM pre_assigned_helper pah JOIN rt_booking_on_the_go b ON booking_app_id = pah.booking_app_id WHERE booking_status IN ('Requested', 'Schedule') ) and deactivate_account = 0 and last_seen >= NOW() - INTERVAL 96 HOUR and latitude IS NOT NULL and longitude IS NOT NULL and category_id <> '' and last_seen IS NOT NULL ORDER BY distance ASC LIMIT 1 Time : 13:01:32 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'h.id' in 'IN/ALL/ANY subquery' Raw SQL : SELECT *, (111.111 * DEGREES(acos(cos(radians(31.1075588)) * cos(radians(latitude)) * cos(radians(longitude) - radians(77.1959622)) + sin (radians(31.1075588)) * sin(radians(latitude)) ))) AS distance from rt_service_providers where status = 1 and (FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1' OR FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1') and amount > 0 and (FIND_IN_SET(1, category_id) OR FIND_IN_SET(20, category_id) OR FIND_IN_SET(8, category_id) OR FIND_IN_SET(17, category_id) OR FIND_IN_SET(2, category_id) ) AND h.id NOT IN ( SELECT DISTINCT provider_id FROM rt_booking_on_the_go WHERE DATE(date_time) = CURDATE() AND booking_status IN ('Accepted', 'Started') ) -- 2️⃣ Do not select providers who are already pre-assigned AND h.id NOT IN ( SELECT pah.provider_id FROM pre_assigned_helper pah JOIN rt_booking_on_the_go b ON b.booking_app_id = pah.booking_app_id WHERE b.booking_status IN ('Requested', 'Schedule') ) and deactivate_account = 0 and last_seen >= NOW() - INTERVAL 96 HOUR and latitude IS NOT NULL and longitude IS NOT NULL and category_id <> '' and last_seen IS NOT NULL ORDER BY distance ASC LIMIT 1 Time : 13:00:32 SQLSTATE[42000]: Syntax error or access violation: 1582 Incorrect parameter count in the call to native function 'radians' Raw SQL : SELECT *, (111.111 * DEGREES(acos(cos(radians()) * cos(radians(latitude)) * cos(radians(longitude) - radians()) + sin (radians()) * sin(radians(latitude)) ))) AS distance from rt_service_providers where status = 1 and (FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1' OR FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1') and amount > 0 and (FIND_IN_SET(1, category_id) OR FIND_IN_SET(20, category_id) OR FIND_IN_SET(8, category_id) OR FIND_IN_SET(17, category_id) OR FIND_IN_SET(2, category_id) ) AND h.id NOT IN ( SELECT DISTINCT provider_id FROM rt_booking_on_the_go WHERE DATE(date_time) = CURDATE() AND booking_status IN ('Accepted', 'Started') ) -- 2️⃣ Do not select providers who are already pre-assigned AND h.id NOT IN ( SELECT pah.provider_id FROM pre_assigned_helper pah JOIN rt_booking_on_the_go b ON b.booking_app_id = pah.booking_app_id WHERE b.booking_status IN ('Requested', 'Schedule') ) and deactivate_account = 0 and last_seen >= NOW() - INTERVAL 96 HOUR and latitude IS NOT NULL and longitude IS NOT NULL and category_id <> '' and last_seen IS NOT NULL ORDER BY distance ASC LIMIT 1 Time : 13:00:05 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and amount > 0 and (FIND_IN_SET(1, category_id) ' at line 3 Raw SQL : SELECT *, (111.111 * DEGREES(acos(cos(radians()) * cos(radians(latitude)) * cos(radians(longitude) - radians()) + sin (radians()) * sin(radians(latitude)) ))) AS distance from rt_service_providers where status = 1 and (FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1' OR FIND_IN_SET(1, sub_category_id) OR sub_category_id = '1') and and amount > 0 and (FIND_IN_SET(1, category_id) OR FIND_IN_SET(20, category_id) OR FIND_IN_SET(8, category_id) OR FIND_IN_SET(17, category_id) OR FIND_IN_SET(2, category_id) ) AND h.id NOT IN ( SELECT DISTINCT provider_id FROM rt_booking_on_the_go WHERE DATE(date_time) = CURDATE() AND booking_status IN ('Accepted', 'Started') ) -- 2️⃣ Do not select providers who are already pre-assigned AND h.id NOT IN ( SELECT pah.provider_id FROM pre_assigned_helper pah JOIN rt_booking_on_the_go b ON b.booking_app_id = pah.booking_app_id WHERE b.booking_status IN ('Requested', 'Schedule') ) and deactivate_account = 0 and last_seen >= NOW() - INTERVAL 96 HOUR and latitude IS NOT NULL and longitude IS NOT NULL and category_id <> '' and last_seen IS NOT NULL ORDER BY distance ASC LIMIT 1 Time : 12:16:26 SQLSTATE[HY093]: Invalid parameter number Raw SQL : SELECT h.id AS provider_id, h.provider_name, h.latitude, h.longitude, h.amount, h.last_seen FROM rt_service_providers h WHERE h.amount > 52 -- AND h.today_available='yes' AND h.status=1 -- 1️⃣ Do not select providers who already accepted/started a booking today AND h.id NOT IN ( SELECT DISTINCT provider_id FROM rt_booking_on_the_go WHERE DATE(date_time) = CURDATE() AND booking_status IN ('Accepted', 'Started') ) AND ( ? = 'noPreference' OR h.gender = ? ) -- 2️⃣ Do not select providers who are already pre-assigned AND h.id NOT IN ( SELECT pah.provider_id FROM pre_assigned_helper pah JOIN rt_booking_on_the_go b ON b.booking_app_id = pah.booking_app_id WHERE b.booking_status IN ('Requested', 'Schedule') ) -- 3️⃣ Must be available (optional) -- AND h.is_available = 1 ORDER BY (POW(h.latitude - 31.1075588, 2) + POW(h.longitude - 77.1959622, 2)) ASC, h.last_seen DESC LIMIT 1 Time : 12:03:23 SQLSTATE[HY093]: Invalid parameter number Raw SQL : UPDATE rt_booking_on_the_go SET temp_provider_id = ? WHERE booking_app_id = ? LIMIT 1 Time : 12:03:14 SQLSTATE[HY093]: Invalid parameter number Raw SQL : UPDATE rt_booking_on_the_go SET temp_provider_id = ? WHERE booking_app_id = ? LIMIT 1 Time : 12:00:27 SQLSTATE[HY093]: Invalid parameter number Raw SQL : UPDATE rt_booking_on_the_go SET temp_provider_id = ? WHERE booking_app_id = ? LIMIT 1 Time : 11:35:01 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'today'' AND booking_type='normal' AND MONTH(date_time) = MONTH(NOW()) AND YEAR(d' at line 1 Raw SQL : SELECT booking_app_id from rt_rewards where provider_id=8 AND order_type=''today'' AND booking_type='normal' AND MONTH(date_time) = MONTH(NOW()) AND YEAR(date_time) = YEAR(NOW()) Time : 11:34:53 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7 Raw SQL : SELECT rt_booking_on_the_go.*, rt_customers.customer_name, rt_customers.phone_number FROM rt_booking_on_the_go JOIN rt_customers ON rt_customers.id = rt_booking_on_the_go.user_id WHERE rt_booking_on_the_go.all_provider LIKE '%8,%' AND rt_booking_on_the_go.type='normal' AND rt_booking_on_the_go.provider_id != '8' ORDER BY rt_booking_on_the_go.id DESC LIMIT 0, Time : 11:34:28 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Raw SQL : SELECT rt_booking_on_the_go.*, rt_customers.customer_name, rt_customers.phone_number FROM rt_booking_on_the_go JOIN rt_customers ON (rt_customers.id = rt_booking_on_the_go.user_id) WHERE rt_booking_on_the_go.provider_id = '8' AND type='normal' AND service_type = '1' ORDER BY id DESC LIMIT 0, Time : 11:34:12 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Raw SQL : SELECT rt_booking_on_the_go.*, rt_customers.customer_name, rt_customers.phone_number FROM rt_booking_on_the_go JOIN rt_customers ON (rt_customers.id = rt_booking_on_the_go.user_id) WHERE rt_booking_on_the_go.provider_id = '8' AND type='normal' AND service_type = '1' ORDER BY id DESC LIMIT 0,