ST COURIER
1 snippet পাওয়া গেছে
ST Courier SQL Command
ST Courier SQL Command
20 codes
ST COURIER
▾
TRUNCATE Table a Quarry -- to delete all data in the tables
USE safedelivery_courierdb;
TRUNCATE TABLE delivery_branch_transfers;
TRUNCATE TABLE delivery_branch_transfer_details;
TRUNCATE TABLE parcels;
TRUNCATE TABLE parcel_logs;
TRUNCATE TABLE parcel_delivery_payments;
TRUNCATE TABLE parcel_delivery_payment_details;
TRUNCATE TABLE parcel_merchant_delivery_payments;
TRUNCATE TABLE parcel_merchant_delivery_payment_details;
TRUNCATE TABLE parcel_payment_requests;
TRUNCATE TABLE parcel_pickup_requests;
TRUNCATE TABLE return_branch_transfers;
TRUNCATE TABLE return_branch_transfer_details;
TRUNCATE TABLE rider_payments;
TRUNCATE TABLE rider_runs;
TRUNCATE TABLE rider_run_details;
-- to merchant_id, COUNT(*) AS occurrence_count
SELECT merchant_id, COUNT(*) AS occurrence_count
FROM merchant_service_area_return_charges
GROUP BY merchant_id
HAVING COUNT(*) > 3;
DELETE merchants, merchant_shops
DELETE merchants, merchant_shops
FROM merchants
LEFT JOIN merchant_shops ON merchants.id = merchant_shops.merchant_id
WHERE merchants.m_id = 'M-0304';
DELETE merchants, merchant_shops
DELETE m, ms
FROM merchants m
LEFT JOIN merchant_shops ms ON m.id = ms.merchant_id
WHERE m.m_id = 'M-0132';
DELETE merchants, merchant_shops
DELETE ms, m FROM merchants m JOIN merchant_shops ms ON m.id = ms.merchant_id WHERE m.m_id ='M-0243';
Parcel Return Charge Update
UPDATE `parcels` SET `return_charge` = '0' WHERE `return_charge` != 0 AND `delivery_type` IN (1,2);
Create Time Update
SET @time := NOW();
UPDATE merchants
SET created_at = (@time := DATE_ADD(@time, INTERVAL 1 SECOND))
ORDER BY id ASC;
Number 0 Add
UPDATE riders
SET contact_number = CONCAT('0', contact_number);
-- TO Insart merchant Shop
INSERT INTO merchant_shops (shop_name, shop_address, merchant_id, branch_id, district_id, area_id, contact_number, status, is_default, created_at, updated_at)
SELECT
company_name,
address,
id AS merchant_id,
branch_id,
district_id,
area_id,
contact_number,
1 AS status,
1 AS is_default,
NOW() AS created_at,
NOW() AS updated_at
FROM merchants;
-- UPDATE parcels OTP Code
UPDATE parcels
SET parcel_code = FLOOR(1000 + RAND() * 8000)
WHERE status IN (14, 24);
-- Merchant Payment Check
SELECT * FROM parcel_merchant_delivery_payments WHERE total_payment_amount != 0 AND total_payment_received_amount = 0 AND status = 2
-- Merchant Payment Check
SELECT p.id
FROM parcels p
JOIN parcel_merchant_delivery_payment_details pd
ON p.id = pd.parcel_id
WHERE p.merchant_id = 444
AND p.payment_type != 5;
Parcel Return And Update
UPDATE rider_run_details
SET
complete_note = 'Out Of Coverage',
collected_amount = 0,
status = 7,
delivery_type = 4
WHERE rider_run_id = 15071;
Parcel Return And Update
UPDATE `rider_run_details`
SET
`complete_note` = 'Out Of Coverage',
`collected_amount` = 0,
`status` = 7,
`delivery_type` = 4
WHERE `rider_run_id` = 15071;
Parcel Status Update
UPDATE `parcels` SET
`status` = '24'
WHERE `parcel_invoice` IN (
);
total charge Update
UPDATE parcels
SET cod_charge = 0, cod_percent = 0
WHERE merchant_id = 345 AND cod_percent = 1;
CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
ALTER TABLE merchant_shops CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- This query will insert new records into the `merchant_shops` table by selecting data from the `merchants` table and transforming it as needed.
INSERT INTO merchant_shops (shop_name, shop_address, merchant_id, branch_id, district_id, area_id, contact_number, status, is_default, created_at, updated_at)
SELECT
company_name AS shop_name,
address AS shop_address,
id AS merchant_id,
branch_id,
district_id,
area_id,
contact_number,
1 AS status,
1 AS is_default,
NOW() AS created_at,
NOW() AS updated_at
FROM
merchants;
TRUNCATE TABLE
TRUNCATE TABLE easyfast_courierdb.delivery_branch_transfers;
TRUNCATE TABLE easyfast_courierdb.delivery_branch_transfer_details;
TRUNCATE TABLE easyfast_courierdb.parcels;
TRUNCATE TABLE easyfast_courierdb.parcel_logs;
TRUNCATE TABLE easyfast_courierdb.parcel_delivery_payments;
TRUNCATE TABLE easyfast_courierdb.parcel_delivery_payment_details;
TRUNCATE TABLE easyfast_courierdb.parcel_merchant_delivery_payments;
TRUNCATE TABLE easyfast_courierdb.parcel_merchant_delivery_payment_details;
TRUNCATE TABLE easyfast_courierdb.parcel_payment_requests;
TRUNCATE TABLE easyfast_courierdb.parcel_pickup_requests;
TRUNCATE TABLE easyfast_courierdb.pathao_orders;
TRUNCATE TABLE easyfast_courierdb.pathao_order_details;
TRUNCATE TABLE easyfast_courierdb.pathao_order_detail_logs;
TRUNCATE TABLE easyfast_courierdb.pathao_order_details;
TRUNCATE TABLE easyfast_courierdb.return_branch_transfers;
TRUNCATE TABLE easyfast_courierdb.return_branch_transfer_details;
TRUNCATE TABLE easyfast_courierdb.rider_payments;
TRUNCATE TABLE easyfast_courierdb.rider_runs;
TRUNCATE TABLE easyfast_courierdb.rider_run_details;
TRUNCATE TABLE easyfast_courierdb.branches;
TRUNCATE TABLE easyfast_courierdb.branch_users;
TRUNCATE TABLE easyfast_courierdb.branch_users;
TRUNCATE TABLE easyfast_courierdb.expenses;
TRUNCATE TABLE easyfast_courierdb.email_verifications;
TRUNCATE TABLE easyfast_courierdb.merchants;
TRUNCATE TABLE easyfast_courierdb.merchant_service_area_charges;
TRUNCATE TABLE easyfast_courierdb.merchant_service_area_cod_charges;
TRUNCATE TABLE easyfast_courierdb.merchant_service_area_return_charges;
TRUNCATE TABLE easyfast_courierdb.news_letters;
TRUNCATE TABLE easyfast_courierdb.notifications;
TRUNCATE TABLE easyfast_courierdb.riders;
TRUNCATE TABLE easyfast_courierdb.send_boxes;
TRUNCATE TABLE easyfast_courierdb.service_area_weight_package;
TRUNCATE TABLE easyfast_courierdb.staff;
TRUNCATE TABLE easyfast_courierdb.staff_payments;
TRUNCATE TABLE easyfast_courierdb.visitor_messages;
-- আপনার রিকোয়ারমেন্ট অনুযায়ী, parcels টেবিলে যে সকল merchant_id ব্যবহার করা হয়েছে, শুধু সেই মার্চেন্টদের ডেটা রেখে merchants টেবিল থেকে বাকি সব মার্চেন্টকে ডিলিট করার জন্য একটি SQL কুয়েরি লিখতে হবে।
DELETE FROM `merchants` WHERE `id` NOT IN ( SELECT DISTINCT `merchant_id` FROM `parcels` WHERE `merchant_id` IS NOT NULL );