如何在一个单一的 SQL 语句中制作这个 PHP 脚本?
$sql = 'SELECT oxtprice from oxarticles where oxparentid = ? and nrseriesarticle = 1';
$price = DatabaseProvider::getDb()->getOne($sql, [$id]);
if ($price) {
$updateSql = "Update oxarticles SET nrseriestprice = ? WHERE oxid = ? and oxparentid = ''";
DatabaseProvider::getDb()->execute($updateSql, [$price, $id]);
我想要这样的东西,但它没有用
UPDATE oxarticles SET
nrseriesprice = (SELECT oxprice from oxarticles where oxparentid = ? and nrseriesarticle = 1)
WHERE oxid = ?