我有这个SQL代码:
SELECT t1.offname, t2.offname, t3.offname, t4.offname, t5.offname, t6.offname, t7.offname
FROM AS_ADDROBJ_29 t1
LEFT JOIN AS_ADDROBJ_29 t2 ON t1.parentguid = t2.aoguid AND t1.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t3 ON t2.parentguid = t3.aoguid AND t2.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t4 ON t3.parentguid = t4.aoguid AND t3.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t5 ON t4.parentguid = t5.aoguid AND t4.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t6 ON t5.parentguid = t6.aoguid AND t5.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t7 ON t6.parentguid = t7.aoguid AND t6.parentguid NOT NULL
WHERE t1.offname LIKE "smth%"
当我使用SQLiteManager
执行此操作时,它返回7列,其中一些列等于null。
但AIR只返回t7
表结果,并省略了其他结果。不同的SQLColumnNameStyle-s
不会改变这种情况。
有什么想法吗?
答案 0 :(得分:0)
加入同一个表时出现问题 - 结果会得到许多具有相同名称的列。 AIR sqlite引擎无法正确处理它,但有一个简单的hack:你应该用不同的字符串名称命名所有列。像这样:
SELECT t1.offname AS 'OFFNAME1', t2.offname AS 'OFFNAME2', t3.offname AS 'OFFNAME3',
t4.offname AS 'OFFNAME4', t5.offname AS 'OFFNAME5', t6.offname AS 'OFFNAME6',
t7.offname AS 'OFFNAME7'
FROM AS_ADDROBJ_29 t1
LEFT JOIN AS_ADDROBJ_29 t2 ON t1.parentguid = t2.aoguid AND t1.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t3 ON t2.parentguid = t3.aoguid AND t2.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t4 ON t3.parentguid = t4.aoguid AND t3.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t5 ON t4.parentguid = t5.aoguid AND t4.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t6 ON t5.parentguid = t6.aoguid AND t5.parentguid NOT NULL
LEFT JOIN AS_ADDROBJ_29 t7 ON t6.parentguid = t7.aoguid AND t6.parentguid NOT NULL
WHERE t1.offname LIKE "smth%"
现在在SQLResult.data中,您将拥有带有7个“OFFNAME#”键和所有值的对象。有些值将等于null。