如何在两个表中使用SELECT与WHERE?

时间:2013-11-07 18:25:52

标签: php mysql

SELECT * FROM `table1.column1` 
WHERE `table1.column1` = '1' AND `table2.column2`=1";

我希望一个SELECT从两个表中获得WHERE。有可能吗?

4 个答案:

答案 0 :(得分:1)

这可能有所帮助:

SQL

"SELECT * FROM `table1`, `table2` WHERE `table1.column1`='1' AND `table2.column2`='1'";

答案 1 :(得分:1)

Select *
From table1 j,
    table2 k
Where j.column1 = k.column1
    And j.column1 = 1;

答案 2 :(得分:0)

SELECT * FROM `table1`, `table2` 
  WHERE `table1.column1` = '1' 
  AND `table2.column2` = '1';

答案 3 :(得分:0)

SELECT * FROM table1 t, table2 u
WHERE t.PKCol = u.FKCol AND t.DesiredCol = "1"