Why is a token number alone insufficient for an asset join?
A composite join matches multiple fields together when an identifier is unique only within a namespace.
SQLite example and interpretation
Two contracts each issue token one. Match contract and token to look up the right label. Include the chain as well for a multi-network dataset.
WITH s(c,id) AS (VALUES('B',1)), n(c,id,name) AS (VALUES('A',1,'art'),('B',1,'pass')) SELECT name FROM s JOIN n ON s.c=n.c AND s.id=n.id;Result [["pass"]]
中文
关联链上资产时,为什么只比代币编号会认错资产?
复合连接通过多个字段同时匹配,适合标识只在某个命名空间内唯一的数据。
SQLite 示例与适用条件
两个合约各有 1 号资产。把合约和编号一起比较才能得到目标名称;跨网络的数据还应把链标识纳入键。
WITH s(c,id) AS (VALUES('B',1)), n(c,id,name) AS (VALUES('A',1,'art'),('B',1,'pass')) SELECT name FROM s JOIN n ON s.c=n.c AND s.id=n.id;结果 [["pass"]]