我一直在尝试从mysql数据库中检索数据。以下查询不会产生任何结果:
SELECT *
FROM ENTITY_RELATIONSHIPS_TABLE
WHERE ((SUBJECT_GUID = ? AND TARGET_GUID = ?)
OR (TARGET_GUID = ? AND SUBJECT_GUID = ?))
AND RELATIONSHIP_TYPE_VALUE_ID IN (?)
正在删除 ((SUBJECT_GUID = ? AND TARGET_GUID = ?) OR (TARGET_GUID = ? AND SUBJECT_GUID = ?))
使查询工作意味着它是错误的部分。
这样做有效:
SELECT *
FROM ENTITY_RELATIONSHIPS_TABLE
WHERE RELATIONSHIP_TYPE_VALUE_ID IN (?)
这就是我如何附加准备好的数据值:
let todo = [
relGUIDs[0], relGUIDs[1],
relGUIDs[1], relGUIDs[0],
]
for (let i = 0; i < relIdsArr.length; i++) todo.push(relIdsArr[i]);
我怎样才能让下面的查询工作?
SELECT *
FROM ENTITY_RELATIONSHIPS_TABLE
WHERE ((SUBJECT_GUID = ? AND TARGET_GUID = ?)
OR (TARGET_GUID = ? AND SUBJECT_GUID = ?))
AND RELATIONSHIP_TYPE_VALUE_ID IN (?)
提前谢谢大家。
1条答案
按热度按时间vtwuwzda1#
(SUBJECT_GUID = ? AND TARGET_GUID = ?)
以及(TARGET_GUID = ? AND SUBJECT_GUID = ?)
因为你总是比较SUBJECT_GUID
至relGUIDs[0]
以及TARGET_GUID
至relGUIDs[1]
,还有,todo
应该只有5个值,第五个值应该是数组。我不知道你想做什么,但我想你在找这样的东西: