0

谁能帮我一个简单的sql标签吗?

这就是我想要的:

Select * from table1 where transid='select transid from table2 where date='01/02/2003''

如何以正确的 sql 格式保存它?

4

3 回答 3

5

尝试:

Select * 
from table1 
where transid=(select transid from table2 where date='01/02/2003')
于 2012-11-23T23:19:55.360 回答
5
Select * from table1
  where transid in 
    (select transid from table2 where date='01/02/2003')
于 2012-11-23T23:20:28.980 回答
4

或者只是做一个JOIN

SELECT  table1.*
FROM    table1
JOIN    table2
ON      table1.transid=table2.transid
    AND date = '01/02/2003'
于 2012-11-23T23:41:35.597 回答