Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经花了几个小时来弄清楚这个查询但没有结果,
我实际上是 PDO 的新手,我曾经做过 MYSQL,但我在 stackoverflow 上看到我必须更改为 PDO,因为 MYSQL 很快就会被禁用,
所以现在我的问题是,我想在这样的一个查询中选择两个彼此没有关系的不同表,
$query = $dbh->query("SELECT * FROM table1; SELECT * FROM table2"); //rest of query,
我怎么做?
就像你用普通 SQL 做的一样:
$query = $dbh->query("SELECT * FROM table1, table2");
或者使用 JOIN
SELECT t1.id, t2.name FROM users AS t1 JOIN people AS t2 ON t1.id = t2.id;