如果我想使用INNER JOIN
进行更新查询,在这种情况下我该怎么做:
我有users
表& user_settings
表。 users
包含列id
,user_settings
包含列userid
。我想这样做:
UPDATE users_settings SET commets = 0 WHERE email = "$email";
但user_settings
不包含email
,因此我想从email
users
id
表中选择userid
https://api.development.push.apple.com/3/device/<token-device>
答案 0 :(得分:0)
试试这个:
pi@raspberrypi:/etc/apt $ sudo apt-get install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
ffmpeg : Depends: libavcodec56 (>= 10:2.6.9) but it is not going to be installed
Depends: libavdevice56 (>= 10:2.6.9) but it is not going to be installed
Depends: libavfilter5 (>= 10:2.6.9) but it is not going to be installed
Depends: libavformat56 (>= 10:2.6.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
注意:在这些情况下,不应该有任何用户使用相同的电子邮件。
答案 1 :(得分:0)
您可以使用此查询。它会起作用
UPDATE users_settings SET commets = 0 WHERE userid
IN (SELECT id FROM users WHERE email = "$email");
答案 2 :(得分:0)
以下将有所帮助
from functools import partial
from tornado.ioloop import IOLoop
loop = IOLoop.current()
f = partial(bar, i=100)
loop.run_sync(f)
答案 3 :(得分:0)
JOIN
在性能方面略优于SUB QUERIES
。参考here。
所以不要使用它 -
UPDATE users_settings SET commets = 0 WHERE userid
IN (SELECT id FROM users WHERE email = "$email");
我建议使用INNER JOIN
-
UPDATE users_settings
SET commets = 0
FROM user_settings
INNER JOIN users
on users.id = user_settings.userid --JOIN CONDITION
WHERE users.email = "$email" ; --SELECTION/SLICING CRITERION
希望这有帮助。