我正在尝试软锁定记录并同时返回它。此查询在SQL Management Studio或Navicat中按预期工作,但是当我将其放入代码时,它会更新记录但不返回任何内容:
$query = $dbh2->query("UPDATE TOP (1) [_partners_customers_details] SET STATUS = '1'
OUTPUT B.ID AS NEWID,inserted.* FROM _partners_customers_details A
LEFT JOIN Billing_partners_customers B ON A.CIID = B.ID
WHERE A.STATUS IS NULL
");
$OUTPUTS = $query->fetchall();
print_r($OUTPUTS);