如何为此选择查询进行连接

时间:2014-01-06 09:03:43

标签: mysql

如何为我的选择查询进行连接查询,如下所示。

"select a,b from table1 where d in
 (select d from table2 where column1 ='value1' and column2 > '2' );"

1 个答案:

答案 0 :(得分:2)

SELECT DISTINCT a, b
FROM table1 t1
JOIN table2 t2 ON t1.d = t2.d
WHERE t2.column1 = 'value1' AND t2.column2 = 'value2'