main
new
SELECT * FROM `event`
CALL RefreshInventorySummary()
BEGIN -- Call the stored procedure to export inventory data CALL ExportInventoryData(); END
BEGIN -- Delete load records that have no associated bills DELETE bl FROM bill_loads_tbl bl LEFT JOIN bills_tbl bt ON bl.load_id = bt.load_id WHERE bt.load_id IS NULL; -- Optional: Log the action (if you have a logging table) -- INSERT INTO event_logs (event_name, description, executed_at) -- VALUES ('delete_orphaned_loads', CONCAT(ROW_COUNT(), ' orphaned load records deleted'), NOW()); END
CALL RefreshMaterializedViews()
CALL MaintainMonthlyPartitions()