Sql server 2008 根据存储在另一个表中的数据从一个表中检索数据的SQL查询?

Sql server 2008 根据存储在另一个表中的数据从一个表中检索数据的SQL查询?,sql-server-2008,Sql Server 2008,共有3个表:表1、表2和表3 查询是: select column1 from table1 where variable1=@value1 AND variable2=@value2 这里,value1和value2是存储在表2和表3中的全部数据 select colum1 from table1 where variable1 in (select column2 from table2) and variable2 in (select column3 from tabl

共有3个表:表1、表2和表3

查询是:

select column1 from table1 where variable1=@value1 AND variable2=@value2
这里,value1和value2是存储在表2和表3中的全部数据

select colum1
from table1
where
    variable1 in (select column2 from table2) and
    variable2 in (select column3 from table3)
试试这个

select colum1
from table1
where
    variable1 in (select column2 from table2) and
    variable2 in (select column3 from table3)

这个问题不是很清楚,但最接近的猜测是

SELECT column1
FROM table1
JOIN table2 ON table1.variable1 = table2.value1
JOIN table3 ON table1.variable2 = table3.value2

这个问题不是很清楚,但最接近的猜测是

SELECT column1
FROM table1
JOIN table2 ON table1.variable1 = table2.value1
JOIN table3 ON table1.variable2 = table3.value2

value1和value2在表2和表3中有多个值value1和value2在表2和表3中有多个值此问题不太清楚-可能需要编辑它来澄清您的问题。此问题不太清楚-可能需要编辑它来澄清您的问题。