Closed SiddarameshKM closed 1 year ago
SELECT
common_order.
id,
common_order.
user_id,
common_order.
phone,
common_order.
delivery_address,
common_order.
delivery_address_ref_id,
common_order.
address_lat,
common_order.
address_lng,
common_order.
biz_id,
common_order.
biz_location_id,
common_order.
order_state,
common_order.
delivery_charge,
common_order.
packaging_charge,
common_order.
order_subtotal,
common_order.
tax_rate,
common_order.
item_total_tax,
common_order.
order_total,
common_order.
instructions,
common_order.
delivery_date,
common_order.
exp_pickup_dt,
common_order.
payment_mode,
common_order.
fulfillment_mode,
common_order.
order_channel,
common_order.
created,
common_order.
updated,
common_order.
coupon_id,
common_order.
coupon_text,
common_order.
discount,
common_order.
merchant_ref_id,
common_order.
transaction_id,
common_order.
time_slot_start,
common_order.
time_slot_end,
common_order.
item_level_total_charges,
common_order.
item_level_total_taxes,
common_order.
order_level_total_charges,
common_order.
order_level_total_taxes,
common_order.
total_taxes,
common_order.
total_charges,
common_order.
total_weight,
common_order.
modified_from,
common_order.
wallet_credit_applied,
auth_user.
id,
auth_user.
password,
auth_user.
last_login,
auth_user.
is_superuser,
auth_user.
username,
auth_user.
first_name,
auth_user.
last_name,
auth_user.
email,
auth_user.
is_staff,
auth_user.
is_active,
auth_user.
date_joined,
common_biz.
biz_id,
common_biz.
biz_name,
common_biz.
biz_name_en,
common_biz.
biz_name_hi,
common_biz.
biz_name_ar,
common_biz.
biz_name_ja,
common_biz.
biz_name_pt,
common_biz.
biz_name_fr,
common_biz.
biz_name_es,
common_biz.
biz_name_zh_cn,
common_biz.
biz_registered_name,
common_biz.
biz_admin_user_id,
common_biz.
primary_contact,
common_biz.
primary_contact_email,
common_biz.
primary_contact_number,
common_biz.
billing_emails,
common_biz.
billing_phones,
common_biz.
admin_biz_up_message,
common_biz.
biz_address,
common_biz.
contact_phone,
common_biz.
loc_latitude,
common_biz.
loc_longitude,
common_biz.
biz_website,
common_biz.
biz_description,
common_biz.
biz_description_en,
common_biz.
biz_description_hi,
common_biz.
biz_description_ar,
common_biz.
biz_description_ja,
common_biz.
biz_description_pt,
common_biz.
biz_description_fr,
common_biz.
biz_description_es,
common_biz.
biz_description_zh_cn,
common_biz.
logo,
common_biz.
page_background_img,
common_biz.
intro_caption,
common_biz.
welcome_message,
common_biz.
fb_page_id,
common_biz.
fb_places_id,
common_biz.
wall_post_link,
common_biz.
twitter_id,
common_biz.
foursquare_id,
common_biz.
biz_feature_level,
common_biz.
biz_point_deferral_enabled,
common_biz.
deduct_pts_at_rc_claim,
common_biz.
biz_timezone,
common_biz.
biz_currency,
common_biz.
country,
common_biz.
biz_isd_code,
common_biz.
payment_gateway,
common_biz.
pg_acc_key,
common_biz.
pg_acc_secret,
common_biz.
biz_tax_rate,
common_biz.
biz_delivery_charge,
common_biz.
biz_min_order_total,
common_biz.
order_delivery_radius,
common_biz.
order_packaging_charge,
common_biz.
clear_ordering_cache_from_client,
common_biz.
checkout_instructions,
common_biz.
order_placed_email_msg,
common_biz.
order_email_msg_extra,
common_biz.
feedback_instructions,
common_biz.
sms_keyword,
common_biz.
sms_sender_id,
common_biz.
available_direct_email_credits,
common_biz.
is_direct_email_enabled,
common_biz.
is_rewards_enabled,
common_biz.
is_payments_enabled,
common_biz.
is_paypal_enabled,
common_biz.
is_ordering_enabled,
common_biz.
preprocess_order,
common_biz.
is_order_delivery_enabled,
common_biz.
is_order_pay_by_ppc_enabled,
common_biz.
is_order_pickup_enabled,
common_biz.
ordering_pos_integration_enabled,
common_biz.
is_basic_feedback_enabled,
common_biz.
is_cardlinking_enabled,
common_biz.
is_secure_barcode_enabled,
common_biz.
is_prepaid_credit_allowed,
common_biz.
bypass_otp_check_for_prepaid,
common_biz.
activate_phone_prepaid_auto,
common_biz.
merge_pts_with_prepaid_bal,
common_biz.
max_prepaid_transaction_amt,
common_biz.
max_prepaid_credit_limit,
common_biz.
max_allowed_prepaid_balance,
common_biz.
max_order_pending_time,
common_biz.
barcode_format,
common_biz.
point_balance_mapping,
common_biz.
point_use_threshold,
common_biz.
allow_web_custom_script,
common_biz.
web_custom_script_location,
common_biz.
google_analytics_id,
common_biz.
faq,
common_biz.
tos,
common_biz.
privacy_policy,
common_biz.
created,
common_biz.
current_delivery_partner,
common_biz.
dp_acc_key,
common_biz.
dp_acc_secret,
common_biz.
minimum_order_delivery_time,
common_biz.
minimum_order_pickup_time,
common_biz.
is_inventory_integration_enabled,
common_biz.
order_msg_no_stores,
common_biz.
order_msg_store_closed,
common_biz.
order_msg_ordering_disabled,
common_biz.
ordering_website_url,
common_biz.
ordering_use_point_of_delivery,
common_biz.
referral_validity,
common_biz.
referral_ui_label,
common_biz.
referral_share_label,
common_biz.
is_paytm_enabled,
common_biz.
is_simpl_enabled,
common_biz.
is_item_pre_order_enabled,
common_biz.
loyalty_points_expiration_enabled,
common_biz.
default_points_expiry_duration,
common_biz.
s3_media_url,
common_biz.
uses_taxes_and_charges_v2,
common_biz.
enable_email_validation,
common_biz.
enable_cache,
common_biz.
minimum_wallet_credit_threshold,
common_biz.
enable_category_location_association,
common_biz.
item_recommendation_threshold,
common_biz.
is_external_orders_enabled,
common_biz.
supported_languages,
common_biz.
credits,
common_biz.
store_timings_id,
common_biz.
ordering_slots_id,
common_biz.
order_prep_time,
common_biz.
busy_order_prep_time,
common_biz.
migrated_from,
common_biz.
seo_description,
common_biz.
seo_description_en,
common_biz.
seo_description_hi,
common_biz.
seo_description_ar,
common_biz.
seo_description_ja,
common_biz.
seo_description_pt,
common_biz.
seo_description_fr,
common_biz.
seo_description_es,
common_biz.
seo_description_zh_cn,
common_bizlocation.
biz_location_id,
common_bizlocation.
merchant_biz_location_id,
common_bizlocation.
biz_location_nickname,
common_bizlocation.
biz_location_nickname_en,
common_bizlocation.
biz_location_nickname_hi,
common_bizlocation.
biz_location_nickname_ar,
common_bizlocation.
biz_location_nickname_ja,
common_bizlocation.
biz_location_nickname_pt,
common_bizlocation.
biz_location_nickname_fr,
common_bizlocation.
biz_location_nickname_es,
common_bizlocation.
biz_location_nickname_zh_cn,
common_bizlocation.
biz_address,
common_bizlocation.
city,
common_bizlocation.
contact_phone,
common_bizlocation.
loc_latitude,
common_bizlocation.
loc_longitude,
common_bizlocation.
order_delivery_radius,
common_bizlocation.
is_enabled_for_ordering,
common_bizlocation.
ordering_disabled_temporary,
common_bizlocation.
payment_gateway,
common_bizlocation.
pg_acc_key,
common_bizlocation.
pg_acc_secret,
common_bizlocation.
primary_contact_phone,
common_bizlocation.
primary_contact_email,
common_bizlocation.
fb_page_id,
common_bizlocation.
fb_places_id,
common_bizlocation.
foursquare_id,
common_bizlocation.
biz_id,
common_bizlocation.
tax_rate,
common_bizlocation.
delivery_charge,
common_bizlocation.
order_packaging_charge,
common_bizlocation.
geofence_radius_in_miles,
common_bizlocation.
location_message,
common_bizlocation.
hide_name_for_ui,
common_bizlocation.
message_action,
common_bizlocation.
ordering_on_select_message,
common_bizlocation.
created,
common_bizlocation.
is_active,
common_bizlocation.
delivery_partner,
common_bizlocation.
dp_acc_key,
common_bizlocation.
dp_acc_secret,
common_bizlocation.
slug,
common_bizlocation.
zipcodes,
common_bizlocation.
sort_order,
common_bizlocation.
min_order_total,
common_bizlocation.
minimum_order_delivery_time,
common_bizlocation.
minimum_order_pickup_time,
common_bizlocation.
last_inventory_update,
common_bizlocation.
is_ecommerce_warehouse,
common_bizlocation.
store_timings_id,
common_bizlocation.
ordering_slots_id,
common_bizlocation.
description,
common_bizlocation.
description_en,
common_bizlocation.
description_hi,
common_bizlocation.
description_ar,
common_bizlocation.
description_ja,
common_bizlocation.
description_pt,
common_bizlocation.
description_fr,
common_bizlocation.
description_es,
common_bizlocation.
description_zh_cn,
common_bizlocation.
seo_description,
common_bizlocation.
seo_description_en,
common_bizlocation.
seo_description_hi,
common_bizlocation.
seo_description_ar,
common_bizlocation.
seo_description_ja,
common_bizlocation.
seo_description_pt,
common_bizlocation.
seo_description_fr,
common_bizlocation.
seo_description_es,
common_bizlocation.
seo_description_zh_cn,
common_bizlocation.
brand_id,
common_bizlocation.
parent_location,
common_bizlocation.
is_busy,
common_bizlocation.
order_prep_time,
common_bizlocation.
busy_order_prep_time,
common_orderaddress.
id,
common_orderaddress.
order_id,
common_orderaddress.
user_id,
common_orderaddress.
biz_id,
common_orderaddress.
address_1,
common_orderaddress.
address_2,
common_orderaddress.
landmark,
common_orderaddress.
city,
common_orderaddress.
pin,
common_orderaddress.
sub_locality,
common_orderaddress.
latitude,
common_orderaddress.
longitude,
common_orderaddress.
tag,
common_orderaddress.
created,
common_orderaddress.
is_active,
common_orderaddress.
merchant_ref_id,
common_orderaddress.
pod_id,
common_orderaddress.
is_guest_mode,
common_orderaddress.
phone,
common_orderaddress.
name FROM
common_order INNER JOIN
common_bizlocationON (
common_order.
biz_location_id=
common_bizlocation.
biz_location_id) INNER JOIN
common_bizON (
common_order.
biz_id=
common_biz.
biz_id) INNER JOIN
auth_userON (
common_order.
user_id=
auth_user.
id) LEFT OUTER JOIN
common_orderaddressON (
common_order.
id=
common_orderaddress.
order_id) WHERE (
common_order.
delivery_date>= '2023-06-28 18:30:00' AND
common_order.
biz_location_idIN(1442) AND
common_order.
biz_idIN(90549729) AND NOT(
common_order.
order_stateIN('Cancelled-for-modification', 'Expired', 'AWAITING_PAYMENT'))) ORDER BY
common_order.
delivery_dateDESC;
`common_order`.`id`,
`common_order`.`user_id`,
`common_order`.`phone`,
`common_order`.`delivery_address`,
`common_order`.`delivery_address_ref_id`,
`common_order`.`address_lat`,
`common_order`.`address_lng`,
`common_order`.`biz_id`,
`common_order`.`biz_location_id`,
`common_order`.`order_state`,
`common_order`.`delivery_charge`,
`common_order`.`packaging_charge`,
`common_order`.`order_subtotal`,
`common_order`.`tax_rate`,
`common_order`.`item_total_tax`,
`common_order`.`order_total`,
`common_order`.`instructions`,
`common_order`.`delivery_date`,
`common_order`.`exp_pickup_dt`,
`common_order`.`payment_mode`,
`common_order`.`fulfillment_mode`,
`common_order`.`order_channel`,
`common_order`.`created`,
`common_order`.`updated`,
`common_order`.`coupon_id`,
`common_order`.`coupon_text`,
`common_order`.`discount`,
`common_order`.`merchant_ref_id`,
`common_order`.`transaction_id`,
`common_order`.`time_slot_start`,
`common_order`.`time_slot_end`,
`common_order`.`item_level_total_charges`,
`common_order`.`item_level_total_taxes`,
`common_order`.`order_level_total_charges`,
`common_order`.`order_level_total_taxes`,
`common_order`.`total_taxes`,
`common_order`.`total_charges`,
`common_order`.`total_weight`,
`common_order`.`modified_from`,
`common_order`.`wallet_credit_applied`,
`auth_user`.`id`,
`auth_user`.`password`,
`auth_user`.`last_login`,
`auth_user`.`is_superuser`,
`auth_user`.`username`,
`auth_user`.`first_name`,
`auth_user`.`last_name`,
`auth_user`.`email`,
`auth_user`.`is_staff`,
`auth_user`.`is_active`,
`auth_user`.`date_joined`,
`common_biz`.`biz_id`,
`common_biz`.`biz_name`,
`common_biz`.`biz_name_en`,
`common_biz`.`biz_name_hi`,
`common_biz`.`biz_name_ar`,
`common_biz`.`biz_name_ja`,
`common_biz`.`biz_name_pt`,
`common_biz`.`biz_name_fr`,
`common_biz`.`biz_name_es`,
`common_biz`.`biz_name_zh_cn`,
`common_biz`.`biz_registered_name`,
`common_biz`.`biz_admin_user_id`,
`common_biz`.`primary_contact`,
`common_biz`.`primary_contact_email`,
`common_biz`.`primary_contact_number`,
`common_biz`.`billing_emails`,
`common_biz`.`billing_phones`,
`common_biz`.`admin_biz_up_message`,
`common_biz`.`biz_address`,
`common_biz`.`contact_phone`,
`common_biz`.`loc_latitude`,
`common_biz`.`loc_longitude`,
`common_biz`.`biz_website`,
`common_biz`.`biz_description`,
`common_biz`.`biz_description_en`,
`common_biz`.`biz_description_hi`,
`common_biz`.`biz_description_ar`,
`common_biz`.`biz_description_ja`,
`common_biz`.`biz_description_pt`,
`common_biz`.`biz_description_fr`,
`common_biz`.`biz_description_es`,
`common_biz`.`biz_description_zh_cn`,
`common_biz`.`logo`,
`common_biz`.`page_background_img`,
`common_biz`.`intro_caption`,
`common_biz`.`welcome_message`,
`common_biz`.`fb_page_id`,
`common_biz`.`fb_places_id`,
`common_biz`.`wall_post_link`,
`common_biz`.`twitter_id`,
`common_biz`.`foursquare_id`,
`common_biz`.`biz_feature_level`,
`common_biz`.`biz_point_deferral_enabled`,
`common_biz`.`deduct_pts_at_rc_claim`,
`common_biz`.`biz_timezone`,
`common_biz`.`biz_currency`,
`common_biz`.`country`,
`common_biz`.`biz_isd_code`,
`common_biz`.`payment_gateway`,
`common_biz`.`pg_acc_key`,
`common_biz`.`pg_acc_secret`,
`common_biz`.`biz_tax_rate`,
`common_biz`.`biz_delivery_charge`,
`common_biz`.`biz_min_order_total`,
`common_biz`.`order_delivery_radius`,
`common_biz`.`order_packaging_charge`,
`common_biz`.`clear_ordering_cache_from_client`,
`common_biz`.`checkout_instructions`,
`common_biz`.`order_placed_email_msg`,
`common_biz`.`order_email_msg_extra`,
`common_biz`.`feedback_instructions`,
`common_biz`.`sms_keyword`,
`common_biz`.`sms_sender_id`,
`common_biz`.`available_direct_email_credits`,
`common_biz`.`is_direct_email_enabled`,
`common_biz`.`is_rewards_enabled`,
`common_biz`.`is_payments_enabled`,
`common_biz`.`is_paypal_enabled`,
`common_biz`.`is_ordering_enabled`,
`common_biz`.`preprocess_order`,
`common_biz`.`is_order_delivery_enabled`,
`common_biz`.`is_order_pay_by_ppc_enabled`,
`common_biz`.`is_order_pickup_enabled`,
`common_biz`.`ordering_pos_integration_enabled`,
`common_biz`.`is_basic_feedback_enabled`,
`common_biz`.`is_cardlinking_enabled`,
`common_biz`.`is_secure_barcode_enabled`,
`common_biz`.`is_prepaid_credit_allowed`,
`common_biz`.`bypass_otp_check_for_prepaid`,
`common_biz`.`activate_phone_prepaid_auto`,
`common_biz`.`merge_pts_with_prepaid_bal`,
`common_biz`.`max_prepaid_transaction_amt`,
`common_biz`.`max_prepaid_credit_limit`,
`common_biz`.`max_allowed_prepaid_balance`,
`common_biz`.`max_order_pending_time`,
`common_biz`.`barcode_format`,
`common_biz`.`point_balance_mapping`,
`common_biz`.`point_use_threshold`,
`common_biz`.`allow_web_custom_script`,
`common_biz`.`web_custom_script_location`,
`common_biz`.`google_analytics_id`,
`common_biz`.`faq`,
`common_biz`.`tos`,
`common_biz`.`privacy_policy`,
`common_biz`.`created`,
`common_biz`.`current_delivery_partner`,
`common_biz`.`dp_acc_key`,
`common_biz`.`dp_acc_secret`,
`common_biz`.`minimum_order_delivery_time`,
`common_biz`.`minimum_order_pickup_time`,
`common_biz`.`is_inventory_integration_enabled`,
`common_biz`.`order_msg_no_stores`,
`common_biz`.`order_msg_store_closed`,
`common_biz`.`order_msg_ordering_disabled`,
`common_biz`.`ordering_website_url`,
`common_biz`.`ordering_use_point_of_delivery`,
`common_biz`.`referral_validity`,
`common_biz`.`referral_ui_label`,
`common_biz`.`referral_share_label`,
`common_biz`.`is_paytm_enabled`,
`common_biz`.`is_simpl_enabled`,
`common_biz`.`is_item_pre_order_enabled`,
`common_biz`.`loyalty_points_expiration_enabled`,
`common_biz`.`default_points_expiry_duration`,
`common_biz`.`s3_media_url`,
`common_biz`.`uses_taxes_and_charges_v2`,
`common_biz`.`enable_email_validation`,
`common_biz`.`enable_cache`,
`common_biz`.`minimum_wallet_credit_threshold`,
`common_biz`.`enable_category_location_association`,
`common_biz`.`item_recommendation_threshold`,
`common_biz`.`is_external_orders_enabled`,
`common_biz`.`supported_languages`,
`common_biz`.`credits`,
`common_biz`.`store_timings_id`,
`common_biz`.`ordering_slots_id`,
`common_biz`.`order_prep_time`,
`common_biz`.`busy_order_prep_time`,
`common_biz`.`migrated_from`,
`common_biz`.`seo_description`,
`common_biz`.`seo_description_en`,
`common_biz`.`seo_description_hi`,
`common_biz`.`seo_description_ar`,
`common_biz`.`seo_description_ja`,
`common_biz`.`seo_description_pt`,
`common_biz`.`seo_description_fr`,
`common_biz`.`seo_description_es`,
`common_biz`.`seo_description_zh_cn`,
`common_bizlocation`.`biz_location_id`,
`common_bizlocation`.`merchant_biz_location_id`,
`common_bizlocation`.`biz_location_nickname`,
`common_bizlocation`.`biz_location_nickname_en`,
`common_bizlocation`.`biz_location_nickname_hi`,
`common_bizlocation`.`biz_location_nickname_ar`,
`common_bizlocation`.`biz_location_nickname_ja`,
`common_bizlocation`.`biz_location_nickname_pt`,
`common_bizlocation`.`biz_location_nickname_fr`,
`common_bizlocation`.`biz_location_nickname_es`,
`common_bizlocation`.`biz_location_nickname_zh_cn`,
`common_bizlocation`.`biz_address`,
`common_bizlocation`.`city`,
`common_bizlocation`.`contact_phone`,
`common_bizlocation`.`loc_latitude`,
`common_bizlocation`.`loc_longitude`,
`common_bizlocation`.`order_delivery_radius`,
`common_bizlocation`.`is_enabled_for_ordering`,
`common_bizlocation`.`ordering_disabled_temporary`,
`common_bizlocation`.`payment_gateway`,
`common_bizlocation`.`pg_acc_key`,
`common_bizlocation`.`pg_acc_secret`,
`common_bizlocation`.`primary_contact_phone`,
`common_bizlocation`.`primary_contact_email`,
`common_bizlocation`.`fb_page_id`,
`common_bizlocation`.`fb_places_id`,
`common_bizlocation`.`foursquare_id`,
`common_bizlocation`.`biz_id`,
`common_bizlocation`.`tax_rate`,
`common_bizlocation`.`delivery_charge`,
`common_bizlocation`.`order_packaging_charge`,
`common_bizlocation`.`geofence_radius_in_miles`,
`common_bizlocation`.`location_message`,
`common_bizlocation`.`hide_name_for_ui`,
`common_bizlocation`.`message_action`,
`common_bizlocation`.`ordering_on_select_message`,
`common_bizlocation`.`created`,
`common_bizlocation`.`is_active`,
`common_bizlocation`.`delivery_partner`,
`common_bizlocation`.`dp_acc_key`,
`common_bizlocation`.`dp_acc_secret`,
`common_bizlocation`.`slug`,
`common_bizlocation`.`zipcodes`,
`common_bizlocation`.`sort_order`,
`common_bizlocation`.`min_order_total`,
`common_bizlocation`.`minimum_order_delivery_time`,
`common_bizlocation`.`minimum_order_pickup_time`,
`common_bizlocation`.`last_inventory_update`,
`common_bizlocation`.`is_ecommerce_warehouse`,
`common_bizlocation`.`store_timings_id`,
`common_bizlocation`.`ordering_slots_id`,
`common_bizlocation`.`description`,
`common_bizlocation`.`description_en`,
`common_bizlocation`.`description_hi`,
`common_bizlocation`.`description_ar`,
`common_bizlocation`.`description_ja`,
`common_bizlocation`.`description_pt`,
`common_bizlocation`.`description_fr`,
`common_bizlocation`.`description_es`,
`common_bizlocation`.`description_zh_cn`,
`common_bizlocation`.`seo_description`,
`common_bizlocation`.`seo_description_en`,
`common_bizlocation`.`seo_description_hi`,
`common_bizlocation`.`seo_description_ar`,
`common_bizlocation`.`seo_description_ja`,
`common_bizlocation`.`seo_description_pt`,
`common_bizlocation`.`seo_description_fr`,
`common_bizlocation`.`seo_description_es`,
`common_bizlocation`.`seo_description_zh_cn`,
`common_bizlocation`.`brand_id`,
`common_bizlocation`.`parent_location`,
`common_bizlocation`.`is_busy`,
`common_bizlocation`.`order_prep_time`,
`common_bizlocation`.`busy_order_prep_time`,
`common_orderaddress`.`id`,
`common_orderaddress`.`order_id`,
`common_orderaddress`.`user_id`,
`common_orderaddress`.`biz_id`,
`common_orderaddress`.`address_1`,
`common_orderaddress`.`address_2`,
`common_orderaddress`.`landmark`,
`common_orderaddress`.`city`,
`common_orderaddress`.`pin`,
`common_orderaddress`.`sub_locality`,
`common_orderaddress`.`latitude`,
`common_orderaddress`.`longitude`,
`common_orderaddress`.`tag`,
`common_orderaddress`.`created`,
`common_orderaddress`.`is_active`,
`common_orderaddress`.`merchant_ref_id`,
`common_orderaddress`.`pod_id`,
`common_orderaddress`.`is_guest_mode`,
`common_orderaddress`.`phone`,
`common_orderaddress`.`name`
FROM
`common_order`
INNER JOIN `common_bizlocation` ON (`common_order`.`biz_location_id` = `common_bizlocation`.`biz_location_id`)
INNER JOIN `common_biz` ON (`common_order`.`biz_id` = `common_biz`.`biz_id`)
INNER JOIN `auth_user` ON (`common_order`.`user_id` = `auth_user`.`id`)
LEFT OUTER JOIN `common_orderaddress` ON (`common_order`.`id` = `common_orderaddress`.`order_id`)
WHERE (`common_order`.`delivery_date` >= '2023-06-28 18:30:00'
AND `common_order`.`biz_location_id` IN(1442)
AND `common_order`.`biz_id` IN(90549729)
AND NOT(`common_order`.`order_state` IN('Cancelled-for-modification', 'Expired', 'AWAITING_PAYMENT')))
ORDER BY
`common_order`.`delivery_date` DESC;```
SELECT `common_order`.`id`, `common_order`.`user_id`, `common_order`.`phone`, `common_order`.`delivery_address`, `common_order`.`delivery_address_ref_id`, `common_order`.`address_lat`, `common_order`.`address_lng`, `common_order`.`biz_id`, `common_order`.`biz_location_id`, `common_order`.`order_state`, `common_order`.`delivery_charge`, `common_order`.`packaging_charge`, `common_order`.`order_subtotal`, `common_order`.`tax_rate`, `common_order`.`item_total_tax`, `common_order`.`order_total`, `common_order`.`instructions`, `common_order`.`delivery_date`, `common_order`.`exp_pickup_dt`, `common_order`.`payment_mode`, `common_order`.`fulfillment_mode`, `common_order`.`order_channel`, `common_order`.`created`, `common_order`.`updated`, `common_order`.`coupon_id`, `common_order`.`coupon_text`, `common_order`.`discount`, `common_order`.`merchant_ref_id`, `common_order`.`transaction_id`, `common_order`.`time_slot_start`, `common_order`.`time_slot_end`, `common_order`.`item_level_total_charges`, `common_order`.`item_level_total_taxes`, `common_order`.`order_level_total_charges`, `common_order`.`order_level_total_taxes`, `common_order`.`total_taxes`, `common_order`.`total_charges`, `common_order`.`total_weight`, `common_order`.`modified_from`, `common_order`.`wallet_credit_applied`, `auth_user`.`id`, `auth_user`.`password`, `auth_user`.`last_login`, `auth_user`.`is_superuser`, `auth_user`.`username`, `auth_user`.`first_name`, `auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`is_staff`, `auth_user`.`is_active`, `auth_user`.`date_joined`, `common_biz`.`biz_id`, `common_biz`.`biz_name`, `common_biz`.`biz_name_en`, `common_biz`.`biz_name_hi`, `common_biz`.`biz_name_ar`, `common_biz`.`biz_name_ja`, `common_biz`.`biz_name_pt`, `common_biz`.`biz_name_fr`, `common_biz`.`biz_name_es`, `common_biz`.`biz_name_zh_cn`, `common_biz`.`biz_registered_name`, `common_biz`.`biz_admin_user_id`, `common_biz`.`primary_contact`, `common_biz`.`primary_contact_email`, `common_biz`.`primary_contact_number`, `common_biz`.`billing_emails`, `common_biz`.`billing_phones`, `common_biz`.`admin_biz_up_message`, `common_biz`.`biz_address`, `common_biz`.`contact_phone`, `common_biz`.`loc_latitude`, `common_biz`.`loc_longitude`, `common_biz`.`biz_website`, `common_biz`.`biz_description`, `common_biz`.`biz_description_en`, `common_biz`.`biz_description_hi`, `common_biz`.`biz_description_ar`, `common_biz`.`biz_description_ja`, `common_biz`.`biz_description_pt`, `common_biz`.`biz_description_fr`, `common_biz`.`biz_description_es`, `common_biz`.`biz_description_zh_cn`, `common_biz`.`logo`, `common_biz`.`page_background_img`, `common_biz`.`intro_caption`, `common_biz`.`welcome_message`, `common_biz`.`fb_page_id`, `common_biz`.`fb_places_id`, `common_biz`.`wall_post_link`, `common_biz`.`twitter_id`, `common_biz`.`foursquare_id`, `common_biz`.`biz_feature_level`, `common_biz`.`biz_point_deferral_enabled`, `common_biz`.`deduct_pts_at_rc_claim`, `common_biz`.`biz_timezone`, `common_biz`.`biz_currency`, `common_biz`.`country`, `common_biz`.`biz_isd_code`, `common_biz`.`payment_gateway`, `common_biz`.`pg_acc_key`, `common_biz`.`pg_acc_secret`, `common_biz`.`biz_tax_rate`, `common_biz`.`biz_delivery_charge`, `common_biz`.`biz_min_order_total`, `common_biz`.`order_delivery_radius`, `common_biz`.`order_packaging_charge`, `common_biz`.`clear_ordering_cache_from_client`, `common_biz`.`checkout_instructions`, `common_biz`.`order_placed_email_msg`, `common_biz`.`order_email_msg_extra`, `common_biz`.`feedback_instructions`, `common_biz`.`sms_keyword`, `common_biz`.`sms_sender_id`, `common_biz`.`available_direct_email_credits`, `common_biz`.`is_direct_email_enabled`, `common_biz`.`is_rewards_enabled`, `common_biz`.`is_payments_enabled`, `common_biz`.`is_paypal_enabled`, `common_biz`.`is_ordering_enabled`, `common_biz`.`preprocess_order`, `common_biz`.`is_order_delivery_enabled`, `common_biz`.`is_order_pay_by_ppc_enabled`, `common_biz`.`is_order_pickup_enabled`, `common_biz`.`ordering_pos_integration_enabled`, `common_biz`.`is_basic_feedback_enabled`, `common_biz`.`is_cardlinking_enabled`, `common_biz`.`is_secure_barcode_enabled`, `common_biz`.`is_prepaid_credit_allowed`, `common_biz`.`bypass_otp_check_for_prepaid`, `common_biz`.`activate_phone_prepaid_auto`, `common_biz`.`merge_pts_with_prepaid_bal`, `common_biz`.`max_prepaid_transaction_amt`, `common_biz`.`max_prepaid_credit_limit`, `common_biz`.`max_allowed_prepaid_balance`, `common_biz`.`max_order_pending_time`, `common_biz`.`barcode_format`, `common_biz`.`point_balance_mapping`, `common_biz`.`point_use_threshold`, `common_biz`.`allow_web_custom_script`, `common_biz`.`web_custom_script_location`, `common_biz`.`google_analytics_id`, `common_biz`.`faq`, `common_biz`.`tos`, `common_biz`.`privacy_policy`, `common_biz`.`created`, `common_biz`.`current_delivery_partner`, `common_biz`.`dp_acc_key`, `common_biz`.`dp_acc_secret`, `common_biz`.`minimum_order_delivery_time`, `common_biz`.`minimum_order_pickup_time`, `common_biz`.`is_inventory_integration_enabled`, `common_biz`.`order_msg_no_stores`, `common_biz`.`order_msg_store_closed`, `common_biz`.`order_msg_ordering_disabled`, `common_biz`.`ordering_website_url`, `common_biz`.`ordering_use_point_of_delivery`, `common_biz`.`referral_validity`, `common_biz`.`referral_ui_label`, `common_biz`.`referral_share_label`, `common_biz`.`is_paytm_enabled`, `common_biz`.`is_simpl_enabled`, `common_biz`.`is_item_pre_order_enabled`, `common_biz`.`loyalty_points_expiration_enabled`, `common_biz`.`default_points_expiry_duration`, `common_biz`.`s3_media_url`, `common_biz`.`uses_taxes_and_charges_v2`, `common_biz`.`enable_email_validation`, `common_biz`.`enable_cache`, `common_biz`.`minimum_wallet_credit_threshold`, `common_biz`.`enable_category_location_association`, `common_biz`.`item_recommendation_threshold`, `common_biz`.`is_external_orders_enabled`, `common_biz`.`supported_languages`, `common_biz`.`credits`, `common_biz`.`store_timings_id`, `common_biz`.`ordering_slots_id`, `common_biz`.`order_prep_time`, `common_biz`.`busy_order_prep_time`, `common_biz`.`migrated_from`, `common_biz`.`seo_description`, `common_biz`.`seo_description_en`, `common_biz`.`seo_description_hi`, `common_biz`.`seo_description_ar`, `common_biz`.`seo_description_ja`, `common_biz`.`seo_description_pt`, `common_biz`.`seo_description_fr`, `common_biz`.`seo_description_es`, `common_biz`.`seo_description_zh_cn`, `common_bizlocation`.`biz_location_id`, `common_bizlocation`.`merchant_biz_location_id`, `common_bizlocation`.`biz_location_nickname`, `common_bizlocation`.`biz_location_nickname_en`, `common_bizlocation`.`biz_location_nickname_hi`, `common_bizlocation`.`biz_location_nickname_ar`, `common_bizlocation`.`biz_location_nickname_ja`, `common_bizlocation`.`biz_location_nickname_pt`, `common_bizlocation`.`biz_location_nickname_fr`, `common_bizlocation`.`biz_location_nickname_es`, `common_bizlocation`.`biz_location_nickname_zh_cn`, `common_bizlocation`.`biz_address`, `common_bizlocation`.`city`, `common_bizlocation`.`contact_phone`, `common_bizlocation`.`loc_latitude`, `common_bizlocation`.`loc_longitude`, `common_bizlocation`.`order_delivery_radius`, `common_bizlocation`.`is_enabled_for_ordering`, `common_bizlocation`.`ordering_disabled_temporary`, `common_bizlocation`.`payment_gateway`, `common_bizlocation`.`pg_acc_key`, `common_bizlocation`.`pg_acc_secret`, `common_bizlocation`.`primary_contact_phone`, `common_bizlocation`.`primary_contact_email`, `common_bizlocation`.`fb_page_id`, `common_bizlocation`.`fb_places_id`, `common_bizlocation`.`foursquare_id`, `common_bizlocation`.`biz_id`, `common_bizlocation`.`tax_rate`, `common_bizlocation`.`delivery_charge`, `common_bizlocation`.`order_packaging_charge`, `common_bizlocation`.`geofence_radius_in_miles`, `common_bizlocation`.`location_message`, `common_bizlocation`.`hide_name_for_ui`, `common_bizlocation`.`message_action`, `common_bizlocation`.`ordering_on_select_message`, `common_bizlocation`.`created`, `common_bizlocation`.`is_active`, `common_bizlocation`.`delivery_partner`, `common_bizlocation`.`dp_acc_key`, `common_bizlocation`.`dp_acc_secret`, `common_bizlocation`.`slug`, `common_bizlocation`.`zipcodes`, `common_bizlocation`.`sort_order`, `common_bizlocation`.`min_order_total`, `common_bizlocation`.`minimum_order_delivery_time`, `common_bizlocation`.`minimum_order_pickup_time`, `common_bizlocation`.`last_inventory_update`, `common_bizlocation`.`is_ecommerce_warehouse`, `common_bizlocation`.`store_timings_id`, `common_bizlocation`.`ordering_slots_id`, `common_bizlocation`.`description`, `common_bizlocation`.`description_en`, `common_bizlocation`.`description_hi`, `common_bizlocation`.`description_ar`, `common_bizlocation`.`description_ja`, `common_bizlocation`.`description_pt`, `common_bizlocation`.`description_fr`, `common_bizlocation`.`description_es`, `common_bizlocation`.`description_zh_cn`, `common_bizlocation`.`seo_description`, `common_bizlocation`.`seo_description_en`, `common_bizlocation`.`seo_description_hi`, `common_bizlocation`.`seo_description_ar`, `common_bizlocation`.`seo_description_ja`, `common_bizlocation`.`seo_description_pt`, `common_bizlocation`.`seo_description_fr`, `common_bizlocation`.`seo_description_es`, `common_bizlocation`.`seo_description_zh_cn`, `common_bizlocation`.`brand_id`, `common_bizlocation`.`parent_location`, `common_bizlocation`.`is_busy`, `common_bizlocation`.`order_prep_time`, `common_bizlocation`.`busy_order_prep_time`, `common_orderaddress`.`id`, `common_orderaddress`.`order_id`, `common_orderaddress`.`user_id`, `common_orderaddress`.`biz_id`, `common_orderaddress`.`address_1`, `common_orderaddress`.`address_2`, `common_orderaddress`.`landmark`, `common_orderaddress`.`city`, `common_orderaddress`.`pin`, `common_orderaddress`.`sub_locality`, `common_orderaddress`.`latitude`, `common_orderaddress`.`longitude`, `common_orderaddress`.`tag`, `common_orderaddress`.`created`, `common_orderaddress`.`is_active`, `common_orderaddress`.`merchant_ref_id`, `common_orderaddress`.`pod_id`, `common_orderaddress`.`is_guest_mode`, `common_orderaddress`.`phone`, `common_orderaddress`.`name` FROM `common_order` INNER JOIN `auth_user` ON (`common_order`.`user_id` = `auth_user`.`id`) INNER JOIN `common_bizlocation` ON (`common_order`.`biz_location_id` = `common_bizlocation`.`biz_location_id`) INNER JOIN `common_biz` ON (`common_order`.`biz_id` = `common_biz`.`biz_id`) LEFT OUTER JOIN `common_orderaddress` ON (`common_order`.`id` = `common_orderaddress`.`order_id`) WHERE (`common_order`.`user_id` IN (23000070, 23052295, 23010781, 22989842, 23049760, 23010851, 23009286, 22988840, 23038506, 23076397, 23055920, 23016497, 23078454, 12838455, 23021624, 23042617, 23078495, 23071806, 22992447, 22989377, 22992454, 11255879, 23009868, 23060045, 23078478, 23025234, 23020627, 20510804, 22995541, 23078171, 13501530, 23000159, 22989408, 23023204, 23079399, 22992489, 22995050, 23058791, 22990958, 23009393, 23020819, 22993012, 23059580, 23036029, 23025791, 23006852, 22990982, 13912201, 25391244, 23011987, 23059092, 18328727, 23047834, 23002395, 22988460, 22990515, 22987444, 22988469, 23078071, 23027387, 22994110, 23042756, 22995157, 23038169, 11800282, 23021279, 22991592, 23041257, 23007466, 22989547, 23010542, 22992168, 23078131, 23023350, 22993656, 15354624, 23006983, 23033132, 23061469, 22991118, 23011603, 22992149, 23077654, 23025944, 23058201, 22992667, 23050524, 38070356, 22991650, 13648680, 23010603, 23004460, 22993711, 23077685, 22989624, 22993209, 22993723, 22988604, 23034174, 22989632, 22992706, 22992716, 22989282, 21432146, 22993748, 23023450, 22989148, 22446941, 22991710, 23038437, 11669860, 23043430, 22991719, 22989628, 22994794, 22987751, 23041905, 23076158, 23049079, 22991226, 23077098, 23045505, 23025899, 25425985, 22989704, 23038345, 22991245, 22990740, 23040918, 23079841, 23058502, 23047665, 23002536, 13147053, 23061424, 22991293, 22989758, 22990786, 22988231, 22989644, 22992330, 23080397, 22992632, 22987730, 23076822, 23047673, 22991832, 23007197, 23075296, 22990818, 23044603, 22988261, 23012838, 11299303, 23078311, 23041009, 22991346, 22991865, 23040507) AND `common_order`.`order_state` LIKE 'food ready' AND `common_order`.`created` >= '2023-07-07 18:30:00' AND `common_order`.`created` < '2023-07-08 18:30:00' AND `common_order`.`biz_location_id` IN (3359) AND `common_order`.`biz_id` IN (94766228) AND NOT (`common_order`.`order_state` IN ('Cancelled-for-modification', 'Expired', 'AWAITING_PAYMENT'))) ORDER BY `common_order`.`created` DESC;
`
SELECT
common_order
.id
,common_order
.user_id
,common_order
.phone
,common_order
.delivery_address
,common_order
.delivery_address_ref_id
,common_order
.address_lat
,common_order
.address_lng
,common_order
.biz_id
,common_order
.biz_location_id
,common_order
.order_state
,common_order
.delivery_charge
,common_order
.packaging_charge
,common_order
.order_subtotal
,common_order
.tax_rate
,common_order
.item_total_tax
,common_order
.order_total
,common_order
.instructions
,common_order
.delivery_date
,common_order
.exp_pickup_dt
,common_order
.payment_mode
,common_order
.fulfillment_mode
,common_order
.order_channel
,common_order
.created
,common_order
.updated
,common_order
.coupon_id
,common_order
.coupon_text
,common_order
.discount
,common_order
.merchant_ref_id
,common_order
.transaction_id
,common_order
.time_slot_start
,common_order
.time_slot_end
,common_order
.item_level_total_charges
,common_order
.item_level_total_taxes
,common_order
.order_level_total_charges
,common_order
.order_level_total_taxes
,common_order
.total_taxes
,common_order
.total_charges
,common_order
.total_weight
,common_order
.modified_from
,common_order
.wallet_credit_applied
,auth_user
.id
,auth_user
.password
,auth_user
.last_login
,auth_user
.is_superuser
,auth_user
.username
,auth_user
.first_name
,auth_user
.last_name
,auth_user
.email
,auth_user
.is_staff
,auth_user
.is_active
,auth_user
.date_joined
,common_biz
.biz_id
,common_biz
.biz_name
,common_biz
.biz_name_en
,common_biz
.biz_name_hi
,common_biz
.biz_name_ar
,common_biz
.biz_name_ja
,common_biz
.biz_name_pt
,common_biz
.biz_name_fr
,common_biz
.biz_name_es
,common_biz
.biz_name_zh_cn
,common_biz
.biz_registered_name
,common_biz
.biz_admin_user_id
,common_biz
.primary_contact
,common_biz
.primary_contact_email
,common_biz
.primary_contact_number
,common_biz
.billing_emails
,common_biz
.billing_phones
,common_biz
.admin_biz_up_message
,common_biz
.biz_address
,common_biz
.contact_phone
,common_biz
.loc_latitude
,common_biz
.loc_longitude
,common_biz
.biz_website
,common_biz
.biz_description
,common_biz
.biz_description_en
,common_biz
.biz_description_hi
,common_biz
.biz_description_ar
,common_biz
.biz_description_ja
,common_biz
.biz_description_pt
,common_biz
.biz_description_fr
,common_biz
.biz_description_es
,common_biz
.biz_description_zh_cn
,common_biz
.logo
,common_biz
.page_background_img
,common_biz
.intro_caption
,common_biz
.welcome_message
,common_biz
.fb_page_id
,common_biz
.fb_places_id
,common_biz
.wall_post_link
,common_biz
.twitter_id
,common_biz
.foursquare_id
,common_biz
.biz_feature_level
,common_biz
.biz_point_deferral_enabled
,common_biz
.deduct_pts_at_rc_claim
,common_biz
.biz_timezone
,common_biz
.biz_currency
,common_biz
.country
,common_biz
.biz_isd_code
,common_biz
.payment_gateway
,common_biz
.pg_acc_key
,common_biz
.pg_acc_secret
,common_biz
.biz_tax_rate
,common_biz
.biz_delivery_charge
,common_biz
.biz_min_order_total
,common_biz
.order_delivery_radius
,common_biz
.order_packaging_charge
,common_biz
.clear_ordering_cache_from_client
,common_biz
.checkout_instructions
,common_biz
.order_placed_email_msg
,common_biz
.order_email_msg_extra
,common_biz
.feedback_instructions
,common_biz
.sms_keyword
,common_biz
.sms_sender_id
,common_biz
.available_direct_email_credits
,common_biz
.is_direct_email_enabled
,common_biz
.is_rewards_enabled
,common_biz
.is_payments_enabled
,common_biz
.is_paypal_enabled
,common_biz
.is_ordering_enabled
,common_biz
.preprocess_order
,common_biz
.is_order_delivery_enabled
,common_biz
.is_order_pay_by_ppc_enabled
,common_biz
.is_order_pickup_enabled
,common_biz
.ordering_pos_integration_enabled
,common_biz
.is_basic_feedback_enabled
,common_biz
.is_cardlinking_enabled
,common_biz
.is_secure_barcode_enabled
,common_biz
.is_prepaid_credit_allowed
,common_biz
.bypass_otp_check_for_prepaid
,common_biz
.activate_phone_prepaid_auto
,common_biz
.merge_pts_with_prepaid_bal
,common_biz
.max_prepaid_transaction_amt
,common_biz
.max_prepaid_credit_limit
,common_biz
.max_allowed_prepaid_balance
,common_biz
.max_order_pending_time
,common_biz
.barcode_format
,common_biz
.point_balance_mapping
,common_biz
.point_use_threshold
,common_biz
.allow_web_custom_script
,common_biz
.web_custom_script_location
,common_biz
.google_analytics_id
,common_biz
.faq
,common_biz
.tos
,common_biz
.privacy_policy
,common_biz
.created
,common_biz
.current_delivery_partner
,common_biz
.dp_acc_key
,common_biz
.dp_acc_secret
,common_biz
.minimum_order_delivery_time
,common_biz
.minimum_order_pickup_time
,common_biz
.is_inventory_integration_enabled
,common_biz
.order_msg_no_stores
,common_biz
.order_msg_store_closed
,common_biz
.order_msg_ordering_disabled
,common_biz
.ordering_website_url
,common_biz
.ordering_use_point_of_delivery
,common_biz
.referral_validity
,common_biz
.referral_ui_label
,common_biz
.referral_share_label
,common_biz
.is_paytm_enabled
,common_biz
.is_simpl_enabled
,common_biz
.is_item_pre_order_enabled
,common_biz
.loyalty_points_expiration_enabled
,common_biz
.default_points_expiry_duration
,common_biz
.s3_media_url
,common_biz
.uses_taxes_and_charges_v2
,common_biz
.enable_email_validation
,common_biz
.enable_cache
,common_biz
.minimum_wallet_credit_threshold
,common_biz
.enable_category_location_association
,common_biz
.item_recommendation_threshold
,common_biz
.is_external_orders_enabled
,common_biz
.supported_languages
,common_biz
.credits
,common_biz
.store_timings_id
,common_biz
.ordering_slots_id
,common_biz
.order_prep_time
,common_biz
.busy_order_prep_time
,common_biz
.migrated_from
,common_biz
.seo_description
,common_biz
.seo_description_en
,common_biz
.seo_description_hi
,common_biz
.seo_description_ar
,common_biz
.seo_description_ja
,common_biz
.seo_description_pt
,common_biz
.seo_description_fr
,common_biz
.seo_description_es
,common_biz
.seo_description_zh_cn
,common_bizlocation
.biz_location_id
,common_bizlocation
.merchant_biz_location_id
,common_bizlocation
.biz_location_nickname
,common_bizlocation
.biz_location_nickname_en
,common_bizlocation
.biz_location_nickname_hi
,common_bizlocation
.biz_location_nickname_ar
,common_bizlocation
.biz_location_nickname_ja
,common_bizlocation
.biz_location_nickname_pt
,common_bizlocation
.biz_location_nickname_fr
,common_bizlocation
.biz_location_nickname_es
,common_bizlocation
.biz_location_nickname_zh_cn
,common_bizlocation
.biz_address
,common_bizlocation
.city
,common_bizlocation
.contact_phone
,common_bizlocation
.loc_latitude
,common_bizlocation
.loc_longitude
,common_bizlocation
.order_delivery_radius
,common_bizlocation
.is_enabled_for_ordering
,common_bizlocation
.ordering_disabled_temporary
,common_bizlocation
.payment_gateway
,common_bizlocation
.pg_acc_key
,common_bizlocation
.pg_acc_secret
,common_bizlocation
.primary_contact_phone
,common_bizlocation
.primary_contact_email
,common_bizlocation
.fb_page_id
,common_bizlocation
.fb_places_id
,common_bizlocation
.foursquare_id
,common_bizlocation
.biz_id
,common_bizlocation
.tax_rate
,common_bizlocation
.delivery_charge
,common_bizlocation
.order_packaging_charge
,common_bizlocation
.geofence_radius_in_miles
,common_bizlocation
.location_message
,common_bizlocation
.hide_name_for_ui
,common_bizlocation
.message_action
,common_bizlocation
.ordering_on_select_message
,common_bizlocation
.created
,common_bizlocation
.is_active
,common_bizlocation
.delivery_partner
,common_bizlocation
.dp_acc_key
,common_bizlocation
.dp_acc_secret
,common_bizlocation
.slug
,common_bizlocation
.zipcodes
,common_bizlocation
.sort_order
,common_bizlocation
.min_order_total
,common_bizlocation
.minimum_order_delivery_time
,common_bizlocation
.minimum_order_pickup_time
,common_bizlocation
.last_inventory_update
,common_bizlocation
.is_ecommerce_warehouse
,common_bizlocation
.store_timings_id
,common_bizlocation
.ordering_slots_id
,common_bizlocation
.description
,common_bizlocation
.description_en
,common_bizlocation
.description_hi
,common_bizlocation
.description_ar
,common_bizlocation
.description_ja
,common_bizlocation
.description_pt
,common_bizlocation
.description_fr
,common_bizlocation
.description_es
,common_bizlocation
.description_zh_cn
,common_bizlocation
.seo_description
,common_bizlocation
.seo_description_en
,common_bizlocation
.seo_description_hi
,common_bizlocation
.seo_description_ar
,common_bizlocation
.seo_description_ja
,common_bizlocation
.seo_description_pt
,common_bizlocation
.seo_description_fr
,common_bizlocation
.seo_description_es
,common_bizlocation
.seo_description_zh_cn
,common_bizlocation
.brand_id
,common_bizlocation
.parent_location
,common_bizlocation
.is_busy
,common_bizlocation
.order_prep_time
,common_bizlocation
.busy_order_prep_time
,common_orderaddress
.id
,common_orderaddress
.order_id
,common_orderaddress
.user_id
,common_orderaddress
.biz_id
,common_orderaddress
.address_1
,common_orderaddress
.address_2
,common_orderaddress
.landmark
,common_orderaddress
.city
,common_orderaddress
.pin
,common_orderaddress
.sub_locality
,common_orderaddress
.latitude
,common_orderaddress
.longitude
,common_orderaddress
.tag
,common_orderaddress
.created
,common_orderaddress
.is_active
,common_orderaddress
.merchant_ref_id
,common_orderaddress
.pod_id
,common_orderaddress
.is_guest_mode
,common_orderaddress
.phone
,common_orderaddress
.name
FROMcommon_order
INNER JOINauth_user
ON (common_order
.user_id
=auth_user
.id
) INNER JOINcommon_bizlocation
ON (common_order
.biz_location_id
=common_bizlocation
.biz_location_id
) INNER JOINcommon_biz
ON (common_order
.biz_id
=common_biz
.biz_id
) LEFT OUTER JOINcommon_orderaddress
ON (common_order
.id
=common_orderaddress
.order_id
) WHERE (common_order
.user_id
IN (23000070, 23052295, 23010781, 22989842, 23049760, 23010851, 23009286, 22988840, 23038506, 23076397, 23055920, 23016497, 23078454, 12838455, 23021624, 23042617, 23078495, 23071806, 22992447, 22989377, 22992454, 11255879, 23009868, 23060045, 23078478, 23025234, 23020627, 20510804, 22995541, 23078171, 13501530, 23000159, 22989408, 23023204, 23079399, 22992489, 22995050, 23058791, 22990958, 23009393, 23020819, 22993012, 23059580, 23036029, 23025791, 23006852, 22990982, 13912201, 25391244, 23011987, 23059092, 18328727, 23047834, 23002395, 22988460, 22990515, 22987444, 22988469, 23078071, 23027387, 22994110, 23042756, 22995157, 23038169, 11800282, 23021279, 22991592, 23041257, 23007466, 22989547, 23010542, 22992168, 23078131, 23023350, 22993656, 15354624, 23006983, 23033132, 23061469, 22991118, 23011603, 22992149, 23077654, 23025944, 23058201, 22992667, 23050524, 38070356, 22991650, 13648680, 23010603, 23004460, 22993711, 23077685, 22989624, 22993209, 22993723, 22988604, 23034174, 22989632, 22992706, 22992716, 22989282, 21432146, 22993748, 23023450, 22989148, 22446941, 22991710, 23038437, 11669860, 23043430, 22991719, 22989628, 22994794, 22987751, 23041905, 23076158, 23049079, 22991226, 23077098, 23045505, 23025899, 25425985, 22989704, 23038345, 22991245, 22990740, 23040918, 23079841, 23058502, 23047665, 23002536, 13147053, 23061424, 22991293, 22989758, 22990786, 22988231, 22989644, 22992330, 23080397, 22992632, 22987730, 23076822, 23047673, 22991832, 23007197, 23075296, 22990818, 23044603, 22988261, 23012838, 11299303, 23078311, 23041009, 22991346, 22991865, 23040507) ANDcommon_order
.order_state
LIKE 'food ready' ANDcommon_order
.created
>= '2023-07-07 18:30:00' ANDcommon_order
.created
< '2023-07-08 18:30:00' ANDcommon_order
.biz_location_id
IN (3359) ANDcommon_order
.biz_id
IN (94766228) AND NOT (common_order
.order_state
IN ('Cancelled-for-modification', 'Expired', 'AWAITING_PAYMENT'))) ORDER BYcommon_order
.created
DESC;`
SELECT
common_order.
id,
common_order.
user_id,
common_order.
phone,
common_order.
delivery_address,
common_order.
delivery_address_ref_id,
common_order.
address_lat,
common_order.
address_lng,
common_order.
biz_id,
common_order.
biz_location_id,
common_order.
order_state,
common_order.
delivery_charge,
common_order.
packaging_charge,
common_order.
order_subtotal,
common_order.
tax_rate,
common_order.
item_total_tax,
common_order.
order_total,
common_order.
instructions,
common_order.
delivery_date,
common_order.
exp_pickup_dt,
common_order.
payment_mode,
common_order.
fulfillment_mode,
common_order.
order_channel,
common_order.
created,
common_order.
updated,
common_order.
coupon_id,
common_order.
coupon_text,
common_order.
discount,
common_order.
merchant_ref_id,
common_order.
transaction_id,
common_order.
time_slot_start,
common_order.
time_slot_end,
common_order.
item_level_total_charges,
common_order.
item_level_total_taxes,
common_order.
order_level_total_charges,
common_order.
order_level_total_taxes,
common_order.
total_taxes,
common_order.
total_charges,
common_order.
total_weight,
common_order.
modified_from,
common_order.
wallet_credit_applied,
auth_user.
id,
auth_user.
password,
auth_user.
last_login,
auth_user.
is_superuser,
auth_user.
username,
auth_user.
first_name,
auth_user.
last_name,
auth_user.
email,
auth_user.
is_staff,
auth_user.
is_active,
auth_user.
date_joined,
common_biz.
biz_id,
common_biz.
biz_name,
common_biz.
biz_name_en,
common_biz.
biz_name_hi,
common_biz.
biz_name_ar,
common_biz.
biz_name_ja,
common_biz.
biz_name_pt,
common_biz.
biz_name_fr,
common_biz.
biz_name_es,
common_biz.
biz_name_zh_cn,
common_biz.
biz_registered_name,
common_biz.
biz_admin_user_id,
common_biz.
primary_contact,
common_biz.
primary_contact_email,
common_biz.
primary_contact_number,
common_biz.
billing_emails,
common_biz.
billing_phones,
common_biz.
admin_biz_up_message,
common_biz.
biz_address,
common_biz.
contact_phone,
common_biz.
loc_latitude,
common_biz.
loc_longitude,
common_biz.
biz_website,
common_biz.
biz_description,
common_biz.
biz_description_en,
common_biz.
biz_description_hi,
common_biz.
biz_description_ar,
common_biz.
biz_description_ja,
common_biz.
biz_description_pt,
common_biz.
biz_description_fr,
common_biz.
biz_description_es,
common_biz.
biz_description_zh_cn,
common_biz.
logo,
common_biz.
page_background_img,
common_biz.
intro_caption,
common_biz.
welcome_message,
common_biz.
fb_page_id,
common_biz.
fb_places_id,
common_biz.
wall_post_link,
common_biz.
twitter_id,
common_biz.
foursquare_id,
common_biz.
biz_feature_level,
common_biz.
biz_point_deferral_enabled,
common_biz.
deduct_pts_at_rc_claim,
common_biz.
biz_timezone,
common_biz.
biz_currency,
common_biz.
country,
common_biz.
biz_isd_code,
common_biz.
payment_gateway,
common_biz.
pg_acc_key,
common_biz.
pg_acc_secret,
common_biz.
biz_tax_rate,
common_biz.
biz_delivery_charge,
common_biz.
biz_min_order_total,
common_biz.
order_delivery_radius,
common_biz.
order_packaging_charge,
common_biz.
clear_ordering_cache_from_client,
common_biz.
checkout_instructions,
common_biz.
order_placed_email_msg,
common_biz.
order_email_msg_extra,
common_biz.
feedback_instructions,
common_biz.
sms_keyword,
common_biz.
sms_sender_id,
common_biz.
available_direct_email_credits,
common_biz.
is_direct_email_enabled,
common_biz.
is_rewards_enabled,
common_biz.
is_payments_enabled,
common_biz.
is_paypal_enabled,
common_biz.
is_ordering_enabled,
common_biz.
preprocess_order,
common_biz.
is_order_delivery_enabled,
common_biz.
is_order_pay_by_ppc_enabled,
common_biz.
is_order_pickup_enabled,
common_biz.
ordering_pos_integration_enabled,
common_biz.
is_basic_feedback_enabled,
common_biz.
is_cardlinking_enabled,
common_biz.
is_secure_barcode_enabled,
common_biz.
is_prepaid_credit_allowed,
common_biz.
bypass_otp_check_for_prepaid,
common_biz.
activate_phone_prepaid_auto,
common_biz.
merge_pts_with_prepaid_bal,
common_biz.
max_prepaid_transaction_amt,
common_biz.
max_prepaid_credit_limit,
common_biz.
max_allowed_prepaid_balance,
common_biz.
max_order_pending_time,
common_biz.
barcode_format,
common_biz.
point_balance_mapping,
common_biz.
point_use_threshold,
common_biz.
allow_web_custom_script,
common_biz.
web_custom_script_location,
common_biz.
google_analytics_id,
common_biz.
faq,
common_biz.
tos,
common_biz.
privacy_policy,
common_biz.
created,
common_biz.
current_delivery_partner,
common_biz.
dp_acc_key,
common_biz.
dp_acc_secret,
common_biz.
minimum_order_delivery_time,
common_biz.
minimum_order_pickup_time,
common_biz.
is_inventory_integration_enabled,
common_biz.
order_msg_no_stores,
common_biz.
order_msg_store_closed,
common_biz.
order_msg_ordering_disabled,
common_biz.
ordering_website_url,
common_biz.
ordering_use_point_of_delivery,
common_biz.
referral_validity,
common_biz.
referral_ui_label,
common_biz.
referral_share_label,
common_biz.
is_paytm_enabled,
common_biz.
is_simpl_enabled,
common_biz.
is_item_pre_order_enabled,
common_biz.
loyalty_points_expiration_enabled,
common_biz.
default_points_expiry_duration,
common_biz.
s3_media_url,
common_biz.
uses_taxes_and_charges_v2,
common_biz.
enable_email_validation,
common_biz.
enable_cache,
common_biz.
minimum_wallet_credit_threshold,
common_biz.
enable_category_location_association,
common_biz.
item_recommendation_threshold,
common_biz.
is_external_orders_enabled,
common_biz.
supported_languages,
common_biz.
credits,
common_biz.
store_timings_id,
common_biz.
ordering_slots_id,
common_biz.
order_prep_time,
common_biz.
busy_order_prep_time,
common_biz.
migrated_from,
common_biz.
seo_description,
common_biz.
seo_description_en,
common_biz.
seo_description_hi,
common_biz.
seo_description_ar,
common_biz.
seo_description_ja,
common_biz.
seo_description_pt,
common_biz.
seo_description_fr,
common_biz.
seo_description_es,
common_biz.
seo_description_zh_cn,
common_bizlocation.
biz_location_id,
common_bizlocation.
merchant_biz_location_id,
common_bizlocation.
biz_location_nickname,
common_bizlocation.
biz_location_nickname_en,
common_bizlocation.
biz_location_nickname_hi,
common_bizlocation.
biz_location_nickname_ar,
common_bizlocation.
biz_location_nickname_ja,
common_bizlocation.
biz_location_nickname_pt,
common_bizlocation.
biz_location_nickname_fr,
common_bizlocation.
biz_location_nickname_es,
common_bizlocation.
biz_location_nickname_zh_cn,
common_bizlocation.
biz_address,
common_bizlocation.
city,
common_bizlocation.
contact_phone,
common_bizlocation.
loc_latitude,
common_bizlocation.
loc_longitude,
common_bizlocation.
order_delivery_radius,
common_bizlocation.
is_enabled_for_ordering,
common_bizlocation.
ordering_disabled_temporary,
common_bizlocation.
payment_gateway,
common_bizlocation.
pg_acc_key,
common_bizlocation.
pg_acc_secret,
common_bizlocation.
primary_contact_phone,
common_bizlocation.
primary_contact_email,
common_bizlocation.
fb_page_id,
common_bizlocation.
fb_places_id,
common_bizlocation.
foursquare_id,
common_bizlocation.
biz_id,
common_bizlocation.
tax_rate,
common_bizlocation.
delivery_charge,
common_bizlocation.
order_packaging_charge,
common_bizlocation.
geofence_radius_in_miles,
common_bizlocation.
location_message,
common_bizlocation.
hide_name_for_ui,
common_bizlocation.
message_action,
common_bizlocation.
ordering_on_select_message,
common_bizlocation.
created,
common_bizlocation.
is_active,
common_bizlocation.
delivery_partner,
common_bizlocation.
dp_acc_key,
common_bizlocation.
dp_acc_secret,
common_bizlocation.
slug,
common_bizlocation.
zipcodes,
common_bizlocation.
sort_order,
common_bizlocation.
min_order_total,
common_bizlocation.
minimum_order_delivery_time,
common_bizlocation.
minimum_order_pickup_time,
common_bizlocation.
last_inventory_update,
common_bizlocation.
is_ecommerce_warehouse,
common_bizlocation.
store_timings_id,
common_bizlocation.
ordering_slots_id,
common_bizlocation.
description,
common_bizlocation.
description_en,
common_bizlocation.
description_hi,
common_bizlocation.
description_ar,
common_bizlocation.
description_ja,
common_bizlocation.
description_pt,
common_bizlocation.
description_fr,
common_bizlocation.
description_es,
common_bizlocation.
description_zh_cn,
common_bizlocation.
seo_description,
common_bizlocation.
seo_description_en,
common_bizlocation.
seo_description_hi,
common_bizlocation.
seo_description_ar,
common_bizlocation.
seo_description_ja,
common_bizlocation.
seo_description_pt,
common_bizlocation.
seo_description_fr,
common_bizlocation.
seo_description_es,
common_bizlocation.
seo_description_zh_cn,
common_bizlocation.
brand_id,
common_bizlocation.
parent_location,
common_bizlocation.
is_busy,
common_bizlocation.
order_prep_time,
common_bizlocation.
busy_order_prep_time,
common_orderaddress.
id,
common_orderaddress.
order_id,
common_orderaddress.
user_id,
common_orderaddress.
biz_id,
common_orderaddress.
address_1,
common_orderaddress.
address_2,
common_orderaddress.
landmark,
common_orderaddress.
city,
common_orderaddress.
pin,
common_orderaddress.
sub_locality,
common_orderaddress.
latitude,
common_orderaddress.
longitude,
common_orderaddress.
tag,
common_orderaddress.
created,
common_orderaddress.
is_active,
common_orderaddress.
merchant_ref_id,
common_orderaddress.
pod_id,
common_orderaddress.
is_guest_mode,
common_orderaddress.
phone,
common_orderaddress.
nameFROM
common_orderINNER JOIN
common_bizlocationON (
common_order.
biz_location_id=
common_bizlocation.
biz_location_id) INNER JOIN
common_bizON (
common_order.
biz_id=
common_biz.
biz_id) INNER JOIN
auth_userON (
common_order.
user_id=
auth_user.
id) LEFT OUTER JOIN
common_orderaddressON (
common_order.
id=
common_orderaddress.
order_id) WHERE (
common_order.
delivery_date>= '2023-06-28 18:30:00' AND
common_order.
biz_location_idIN(1442) AND
common_order.
biz_idIN(90549729) AND NOT(
common_order.
order_stateIN('Cancelled-for-modification', 'Expired', 'AWAITING_PAYMENT'))) ORDER BY
common_order.
delivery_dateDESC;