你好,我想与对方相交2长的,但我发现,你只能相交简单的。有可能得到这样的东西吗?
SELECT id, name as antibodyName
FROM Antibodies
WHERE id IN (
(SELECT id FROM Antibodies WHERE name LIKE ?
UNION ALL
SELECT antiId FROM AssignedColors WHERE name LIKE ?
UNION ALL
SELECT antiId FROM AssignedReactivities WHERE name LIKE ?)
INTERSECT
(SELECT id FROM Antibodies WHERE name LIKE ?
UNION ALL
SELECT antiId FROM AssignedColors WHERE name LIKE ?
UNION ALL
SELECT antiId FROM AssignedReactivities WHERE name LIKE ?)
)
AND dateOfCreation >= ? AND dateOfCreation <= ?
ORDER BY dateOfCreation DESC LIMIT ? OFFSET ?;
实际上,我想得到其他查询的交集。
2条答案
按热度按时间uqdfh47h1#
你必须为每组联合查询使用
SELECT
语句:krugob8w2#
如果我正确理解了你的问题,INNER JOIN将有助于最有效地解决问题。可以将内部的SELECT更改为下面的代码,外部的SELECT可以保持不变。