我觉得应该有一种更简单的方法来编写它,因为两个SELECT语句都来自同一个表:
SELECT column1
FROM table1
WHERE column2 = 'VIRTUAL'
AND column3 IN
(SELECT column3
FROM table1
WHERE column1 = 'ELEC-035A');
答案 0 :(得分:0)
这是相同的查询,但我用INNER JOIN
子句替换了子查询:
SELECT T1.column1
FROM table1 T1
INNER JOIN table1 T2 ON T2.column3 = T1.column3
AND T2.column1 = 'ELEC-035A'
WHERE T1.column2 = 'VIRTUAL'
GROUP BY T1.column1
希望这会有所帮助。