{"publisher":"WESWOO","id":"csv-sorted-image-rows","as_of":"2026-11-24","scope":"synthetic reconciliation; run in an empty SQLite database","runtime":"SQLite 3.53.1","title":{"zh":"图片数和顺序号都没变，哪两张图串了商品？","en":"The count and positions match. Which images changed product?"},"case":{"zh":"这份四图样例只交换两件商品的第二张图。总数、位置号、图片文件集合全部相同，按商品标识和位置联查才定位到 A 的第二张用了 b-side、B 的第二张用了 a-side。此查询针对已有位置的错配和缺失；新增位置和重复位置要另查。","en":"Swapping only the second image of each sample product preserves all four files and position numbers. Join on product handle and position: A now has b-side and B has a-side. This query finds changed or missing files at expected positions. Check unexpected and duplicate positions separately."},"setup_sql":"CREATE TABLE reference (handle TEXT, position INTEGER, image TEXT);\nINSERT INTO reference VALUES\n ('A',1,'a-front'),('A',2,'a-side'),('B',1,'b-front'),('B',2,'b-side');\nCREATE TABLE proposed (handle TEXT, position INTEGER, image TEXT);\nINSERT INTO proposed VALUES\n ('A',1,'a-front'),('A',2,'b-side'),('B',1,'b-front'),('B',2,'a-side');","query_sql":"SELECT r.handle, r.position, r.image AS expected, p.image AS proposed\nFROM reference r\nLEFT JOIN proposed p\n  ON p.handle=r.handle AND p.position=r.position\nWHERE p.image IS NOT r.image\nORDER BY r.handle, r.position;","columns":["handle","position","expected","proposed"],"observed":[["A",2,"a-side","b-side"],["B",2,"b-side","a-side"]]}