0

我可以连接如下查询吗?如果没有,我应该如何进行?我不想从中读取行,$retrieveUnitExist因为它浪费了另一个步骤。

$retrieveUnitExist = "SELECT unitid FROM ESTATEUNIT WHERE BLOCK = 1";
$insertAddress = "INSERT INTO ADDRESS (value1, value2) VALUES ('1','".$retrieveUnitExist."')";

mysqli_query($conn, $insertAddress);
4

1 回答 1

7

像这样的东西?

$insertAddress = "INSERT INTO ADDRESS (value1, value2)
                  SELECT '1', unitid FROM ESTATEUNIT WHERE BLOCK = 1";
于 2013-03-26T15:58:02.520 回答