0

我在这里查询这张表

SELECT
  a.ESN,
  b.URL,
  a.Status,
  a.GroupID,
  a.RouteID
FROM STx a
  LEFT JOIN Routes b
    ON a.RouteID = b.RouteID
WHERE a.GroupID = 39
    AND a.Status = "Provisioned"
order by a.ESN;

现在从这个结果集中,我想修改表Routes的url以从第一个查询的结果中测试url列中的所有行。我怎样才能在查询中做到这一点?

4

2 回答 2

0

如果我正确理解您的问题,您希望将从原始查询中获得的所有结果的 URL 列更新为“测试”。

UPDATE Routes
SET URL = 'Test'
FROM STx AS A
LEFT JOIN Routes AS B
ON a.RouteID = b.RouteID
WHERE a.GroupID = 39 AND a.Status = 'Provisioned'
于 2013-02-07T20:14:27.943 回答
0
update Routes set url = 'test' 
where id in (
    select b.id 
    from Stx a left join routes b on a.routeid = b.routeid 
    where a.groupid = 39 and a.status = 'Provisioned'
);
于 2013-02-07T20:13:19.160 回答