{"publisher":"WESWOO","id":"csv-options-integrations","as_of":"2026-11-24","scope":"synthetic reconciliation; run in an empty SQLite database","runtime":"SQLite 3.53.1","title":{"zh":"前台仍叫 Brass，仓库为何找不到 SKU？","en":"The storefront still says Brass. Why is the warehouse SKU missing?"},"case":{"zh":"给同一条样例订单行分别套旧、新映射。名称一直是 Brass，订单里的变体号一直是 518；旧表只认 310，查出的仓库 SKU 为空，新表按 518 得到 WC-BR。先保留订单上的变体号，再对照仓库实际使用的映射版本。样例假定导入后编号已经改变。","en":"The same sample order line says Brass and carries variant 518. The old map knows only 310 and returns no warehouse SKU. The updated map resolves 518 to WC-BR. Retain the variant ID from the actual order and identify which mapping revision fulfilled it. The sample assumes the ID changed."},"setup_sql":"CREATE TABLE order_line (variant_id INTEGER, label TEXT);\nINSERT INTO order_line VALUES (518,'Brass');\nCREATE TABLE warehouse_map (revision TEXT, variant_id INTEGER, sku TEXT);\nINSERT INTO warehouse_map VALUES ('old',310,'WC-BR'),('new',518,'WC-BR');","query_sql":"WITH revisions(revision) AS (VALUES ('old'),('new'))\nSELECT r.revision, l.variant_id, l.label, m.sku\nFROM revisions r CROSS JOIN order_line l\nLEFT JOIN warehouse_map m\n  ON m.revision=r.revision AND m.variant_id=l.variant_id\nORDER BY CASE r.revision WHEN 'old' THEN 1 ELSE 2 END;","columns":["revision","variant_id","label","sku"],"observed":[["old",518,"Brass",null],["new",518,"Brass","WC-BR"]]}