所以我有这个问题:
SELECT
[ProductInstance].ProductInstanceID,
[ProductInstance].Name,
我已经删除了这段代码/问题因为我现在被告知我不能在这里展示它并且不可能把洞穴燃烧掉了
答案 0 :(得分:1)
试一试。根据你的解释,这应该工作。替换“某些价值”'您希望将UPDATE PI
SET
PlatformID = 'some value'
FROM [ITOrder].[dbo].[ProductInstance] PI
INNER JOIN [Product] ON [Product].ProductID = PI.ProductID
INNER JOIN ProductPlacement ON ProductPlacement.ProductInstanceID = PI.ProductInstanceID
WHERE [Product].CategoryID IN(39, 40)
AND ProductPlacement.FK_StatusID = 8
AND PI.PlatformID IS NULL
AND LEFT(PI.Name, 3) = 'AAA';
更新为。
New-AzureRmResourceGroupDeployment : 8:56:34 AM - Resource Microsoft.Compute/virtualMachines 'devSigmaMarketplaceUbuntuVM' failed with message '{
"error": {
"code": "InvalidParameter",
"target": "sourceVault.id",
"message": "The SubscriptionId:\"MY-PERSONAL-ID-b612-4402-b239-0c72253f2c84\" of the request must match the SubscriptionId \"THE-PRODUCTION-ID-4a56-4aa2-92ea-c02f6edf33b5\"
contained in the Key Vault Id."
}
答案 1 :(得分:1)
我会写这样的查询:
UPDATE pi
SETPlatformId = ?
FROM ITOrder.dbo.ProductInstance pi JOIN
Product p
ON p.ProductID = pi.ProductID JOIN
ProductPlacement pp
ON pp.ProductInstanceID = pi.ProductInstanceID
WHERE p.CategoryID IN (39, 40) AND
pp.FK_StatusID = 8 AND
pi.PlatformID IS NULL AND
pi.Name LIKE 'AAA%';
?
代表您想要的值。
变更摘要:
in
代替or
条件链like
进行Name
比较(这允许使用索引)==
更改为=
(后者是标准的相等比较运算符)答案 2 :(得分:1)
您最后可以使用like语句
UPDATE PI
SET
PI.PlatformID = 'some value'
FROM [ITOrder].[dbo].[ProductInstance] PI
INNER JOIN [Product] ON [Product].ProductID = PI.ProductID
INNER JOIN ProductPlacement ON ProductPlacement.ProductInstanceID = PI.ProductInstanceID
WHERE([Product].CategoryID = 39
OR [Product].CategoryID = 40)
AND ProductPlacement.FK_StatusID = 8
AND [ProductInstance].PlatformID IS NULL
AND [ProductInstance].Name LIKE 'AAA%';
答案 3 :(得分:0)
UPDATE ProductInstance
SET
**PI.PlatformID = 'value'**
FROM [ITOrder].[dbo].[ProductInstance] ProductInstance
INNER JOIN [Product] ON [Product].ProductID = ProductInstance.ProductID
INNER JOIN ProductPlacement ON ProductPlacement.ProductInstanceID = PI.ProductInstanceID
WHERE([Product].CategoryID = 39
OR [Product].CategoryID = 40)
AND ProductPlacement.FK_StatusID = 8
AND [ProductInstance].PlatformID IS NULL
**AND [ProductInstance].Name LIKE 'AAA%';**