SQLite:如何更新另一个的值?

时间:2013-10-15 14:57:47

标签: sql sqlite

如何更新列值为2010的其他表中的值?

这是返回我想要的结果的选择SQL语句

SELECT Devices.Name,TempKaspersky.Lisence
FROM TempKaspersky
INNER JOIN devices
On lower(TempKaspersky.MachineName)=devices.name
Where TempKaspersky.Lisence=2010

现在我想用2010更新Devices.lisence列?我怎样才能在SQLite中实现这一目标?

1 个答案:

答案 0 :(得分:2)

这是你想要做的:

UPDATE Devices 
    SET Devices.lisence = 2010 
    WHERE Devices.Name IN 
        (SELECT lower(MachineName) FROM TempKaspersky WHERE Lisence=2010)