Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.83 KB | None | 0 0
  1. SELECT h.id AS h__id, h.driver_user_id AS h__driver_user_id, s.id AS s__id, s.username AS s__username, s.email AS s__email, s.algorithm AS s__algorithm, s.salt AS s__salt, s.password AS s__password, s.is_active AS s__is_active, s.is_super_admin AS s__is_super_admin, s.last_login AS s__last_login, s.cancellation_reason AS s__cancellation_reason, s.created_at AS s__created_at, s.updated_at AS s__updated_at, s.deleted_at AS s__deleted_at, s2.id AS s2__id, s2.user_id AS s2__user_id, s2.is_business_account AS s2__is_business_account, s2.business_account_user_id AS s2__business_account_user_id, s2.business_account_payment_type AS s2__business_account_payment_type, s2.business_account_with_arb AS s2__business_account_with_arb, s2.business_account_url_expiration_date AS s2__business_account_url_expiration_date, s2.business_account_invoice_interval AS s2__business_account_invoice_interval, s2.business_account_ask_employee_for_cc AS s2__business_account_ask_employee_for_cc, s2.authorize_net_customer_profile_id AS s2__authorize_net_customer_profile_id, s2.is_vip AS s2__is_vip, s2.has_old_pricing AS s2__has_old_pricing, s2.facebook_id AS s2__facebook_id, s2.google_id AS s2__google_id, s2.first_name AS s2__first_name, s2.last_name AS s2__last_name, s2.gender AS s2__gender, s2.address AS s2__address, s2.city AS s2__city, s2.state_id AS s2__state_id, s2.zip_code AS s2__zip_code, s2.country_id AS s2__country_id, s2.current_address AS s2__current_address, s2.current_city AS s2__current_city, s2.current_state_id AS s2__current_state_id, s2.current_zip_code AS s2__current_zip_code, s2.current_country_id AS s2__current_country_id, s2.shipping_address AS s2__shipping_address, s2.shipping_city AS s2__shipping_city, s2.shipping_state_id AS s2__shipping_state_id, s2.shipping_zip_code AS s2__shipping_zip_code, s2.shipping_country_id AS s2__shipping_country_id, s2.phone AS s2__phone, s2.secondary_phone AS s2__secondary_phone, s2.birthday AS s2__birthday, s2.social_security_number AS s2__social_security_number, s2.driver_license_number AS s2__driver_license_number, s2.insurance_company AS s2__insurance_company, s2.insurance_policy_number AS s2__insurance_policy_number, s2.has_accidents_last_three_years AS s2__has_accidents_last_three_years, s2.has_dui_ovi_last_five_years AS s2__has_dui_ovi_last_five_years, s2.has_less_license_four_points AS s2__has_less_license_four_points, s2.has_commercial_driving_license AS s2__has_commercial_driving_license, s2.has_previous_professional_driving_experience AS s2__has_previous_professional_driving_experience, s2.has_previous_professional_driving_experience_info AS s2__has_previous_professional_driving_experience_info, s2.has_previous_customer_service_experience AS s2__has_previous_customer_service_experience, s2.has_previous_customer_service_experience_info AS s2__has_previous_customer_service_experience_info, s2.has_business_account_arb AS s2__has_business_account_arb, s2.available_drive_info AS s2__available_drive_info, s2.work_nights_weekends AS s2__work_nights_weekends, s2.puyaycs_partner_name AS s2__puyaycs_partner_name, s2.resume_file AS s2__resume_file, s2.driving_manual_auto AS s2__driving_manual_auto, s2.heard_about_us AS s2__heard_about_us, s2.heard_about_us_other AS s2__heard_about_us_other, s2.interested_designated_driver_service AS s2__interested_designated_driver_service, s2.interested_pickup_service AS s2__interested_pickup_service, s2.skype_id AS s2__skype_id, s2.notes AS s2__notes, s2.photo AS s2__photo, s2.name AS s2__name, s2.website AS s2__website, s2.referer_type AS s2__referer_type, s2.promo_location_id AS s2__promo_location_id, s2.accepted_driver_date AS s2__accepted_driver_date, s2.accepted_new_terms_conditions AS s2__accepted_new_terms_conditions, s2.accepted_new_terms_conditions_timestamp AS s2__accepted_new_terms_conditions_timestamp, s2.has_referral_program AS s2__has_referral_program, s2.agree_driver_referral_program AS s2__agree_driver_referral_program, s2.agree_driver_referral_program_date_time AS s2__agree_driver_referral_program_date_time, s2.available_now AS s2__available_now, s2.created_at AS s2__created_at, s2.updated_at AS s2__updated_at, s2.account_manager_user_id AS s2__account_manager_user_id, s2.notifications AS s2__notifications, s2.driver_order_rating_avg AS s2__driver_order_rating_avg, s2.is_hd_account AS s2__is_hd_account, s2.driver_order_complaints AS s2__driver_order_complaints, s2.driver_completed_orders AS s2__driver_completed_orders, s2.send_feedback_request AS s2__send_feedback_request, s2.first_app_use_at AS s2__first_app_use_at, s2.last_app_ping_at AS s2__last_app_ping_at, s2.first_driver_app_use_at AS s2__first_driver_app_use_at, s2.last_driver_app_ping_at AS s2__last_driver_app_ping_at, s2.receives_invoices AS s2__receives_invoices, s2.card_expiration_date AS s2__card_expiration_date, s2.card_expired_email_sent AS s2__card_expired_email_sent, s2.created_by AS s2__created_by, s2.slug AS s2__slug, s3.id AS s3__id, s3.username AS s3__username, s3.email AS s3__email, s3.algorithm AS s3__algorithm, s3.salt AS s3__salt, s3.password AS s3__password, s3.is_active AS s3__is_active, s3.is_super_admin AS s3__is_super_admin, s3.last_login AS s3__last_login, s3.cancellation_reason AS s3__cancellation_reason, s3.created_at AS s3__created_at, s3.updated_at AS s3__updated_at, s3.deleted_at AS s3__deleted_at, s4.id AS s4__id, s4.user_id AS s4__user_id, s4.is_business_account AS s4__is_business_account, s4.business_account_user_id AS s4__business_account_user_id, s4.business_account_payment_type AS s4__business_account_payment_type, s4.business_account_with_arb AS s4__business_account_with_arb, s4.business_account_url_expiration_date AS s4__business_account_url_expiration_date, s4.business_account_invoice_interval AS s4__business_account_invoice_interval, s4.business_account_ask_employee_for_cc AS s4__business_account_ask_employee_for_cc, s4.authorize_net_customer_profile_id AS s4__authorize_net_customer_profile_id, s4.is_vip AS s4__is_vip, s4.has_old_pricing AS s4__has_old_pricing, s4.facebook_id AS s4__facebook_id, s4.google_id AS s4__google_id, s4.first_name AS s4__first_name, s4.last_name AS s4__last_name, s4.gender AS s4__gender, s4.address AS s4__address, s4.city AS s4__city, s4.state_id AS s4__state_id, s4.zip_code AS s4__zip_code, s4.country_id AS s4__country_id, s4.current_address AS s4__current_address, s4.current_city AS s4__current_city, s4.current_state_id AS s4__current_state_id, s4.current_zip_code AS s4__current_zip_code, s4.current_country_id AS s4__current_country_id, s4.shipping_address AS s4__shipping_address, s4.shipping_city AS s4__shipping_city, s4.shipping_state_id AS s4__shipping_state_id, s4.shipping_zip_code AS s4__shipping_zip_code, s4.shipping_country_id AS s4__shipping_country_id, s4.phone AS s4__phone, s4.secondary_phone AS s4__secondary_phone, s4.birthday AS s4__birthday, s4.social_security_number AS s4__social_security_number, s4.driver_license_number AS s4__driver_license_number, s4.insurance_company AS s4__insurance_company, s4.insurance_policy_number AS s4__insurance_policy_number, s4.has_accidents_last_three_years AS s4__has_accidents_last_three_years, s4.has_dui_ovi_last_five_years AS s4__has_dui_ovi_last_five_years, s4.has_less_license_four_points AS s4__has_less_license_four_points, s4.has_commercial_driving_license AS s4__has_commercial_driving_license, s4.has_previous_professional_driving_experience AS s4__has_previous_professional_driving_experience, s4.has_previous_professional_driving_experience_info AS s4__has_previous_professional_driving_experience_info, s4.has_previous_customer_service_experience AS s4__has_previous_customer_service_experience, s4.has_previous_customer_service_experience_info AS s4__has_previous_customer_service_experience_info, s4.has_business_account_arb AS s4__has_business_account_arb, s4.available_drive_info AS s4__available_drive_info, s4.work_nights_weekends AS s4__work_nights_weekends, s4.puyaycs_partner_name AS s4__puyaycs_partner_name, s4.resume_file AS s4__resume_file, s4.driving_manual_auto AS s4__driving_manual_auto, s4.heard_about_us AS s4__heard_about_us, s4.heard_about_us_other AS s4__heard_about_us_other, s4.interested_designated_driver_service AS s4__interested_designated_driver_service, s4.interested_pickup_service AS s4__interested_pickup_service, s4.skype_id AS s4__skype_id, s4.notes AS s4__notes, s4.photo AS s4__photo, s4.name AS s4__name, s4.website AS s4__website, s4.referer_type AS s4__referer_type, s4.promo_location_id AS s4__promo_location_id, s4.accepted_driver_date AS s4__accepted_driver_date, s4.accepted_new_terms_conditions AS s4__accepted_new_terms_conditions, s4.accepted_new_terms_conditions_timestamp AS s4__accepted_new_terms_conditions_timestamp, s4.has_referral_program AS s4__has_referral_program, s4.agree_driver_referral_program AS s4__agree_driver_referral_program, s4.agree_driver_referral_program_date_time AS s4__agree_driver_referral_program_date_time, s4.available_now AS s4__available_now, s4.created_at AS s4__created_at, s4.updated_at AS s4__updated_at, s4.account_manager_user_id AS s4__account_manager_user_id, s4.notifications AS s4__notifications, s4.driver_order_rating_avg AS s4__driver_order_rating_avg, s4.is_hd_account AS s4__is_hd_account, s4.driver_order_complaints AS s4__driver_order_complaints, s4.driver_completed_orders AS s4__driver_completed_orders, s4.send_feedback_request AS s4__send_feedback_request, s4.first_app_use_at AS s4__first_app_use_at, s4.last_app_ping_at AS s4__last_app_ping_at, s4.first_driver_app_use_at AS s4__first_driver_app_use_at, s4.last_driver_app_ping_at AS s4__last_driver_app_ping_at, s4.receives_invoices AS s4__receives_invoices, s4.card_expiration_date AS s4__card_expiration_date, s4.card_expired_email_sent AS s4__card_expired_email_sent, s4.created_by AS s4__created_by, s4.slug AS s4__slug,
  2.  
  3. (SELECT CONCAT_WS("|", h2.date, h2.time, h2.id) AS h2__0 FROM hd_loaner_service h2 WHERE (h.driver_user_id = h2.driver_user_id AND h2.date >= CURDATE() AND DATE_ADD(h2.time, INTERVAL (h2.estimated_drive_time * (60 * 60)) SECOND) >= CURRENT_TIME()) LIMIT 1) AS h__0,
  4.  
  5. IF((SELECT u.id AS u__id FROM user_location_tracking u WHERE (h.driver_user_id = u.user_id AND u.created_at >= DATE_SUB(NOW(), INTERVAL 5 MINUTE)) LIMIT 1), 1, 0) AS u__1,
  6.  
  7. (SELECT COUNT(*) AS h3__0 FROM hd_loaner_service h3 WHERE (h.driver_user_id = h3.driver_user_id AND h3.date = CURDATE())) AS h__2,
  8.  
  9. (SELECT COUNT(*) AS h4__0 FROM hd_loaner_service h4 WHERE (h.driver_user_id = h4.driver_user_id AND h4.date = DATE_ADD(CURDATE(), INTERVAL 1 day))) AS h__3,
  10.  
  11. (SELECT COUNT(*) AS h5__0 FROM hd_loaner_service h5 WHERE (h.driver_user_id = h5.driver_user_id AND h5.date = DATE_ADD(CURDATE(), INTERVAL 2 day))) AS h__4
  12.  
  13. FROM hd_loaner_service h
  14. INNER JOIN sf_guard_user s ON h.driver_user_id = s.id
  15. INNER JOIN sf_guard_user_profile s2 ON s.id = s2.user_id
  16. LEFT JOIN sf_guard_user s3 ON h.driver_user_id_y = s3.id
  17. LEFT JOIN sf_guard_user_profile s4 ON s3.id = s4.user_id
  18. GROUP BY h.driver_user_id
  19. ORDER BY h__0 IS NULL, h__0 ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement