开发者

Mysql cross table update permission problem

开发者 https://www.devze.com 2023-01-21 22:18 出处:网络
I\'m doing a MySQL query similar to following: UPDATE my_articles a LEFT JOIN categorylinks cl ON a.pageid = cl.cl_from

I'm doing a MySQL query similar to following:

    UPDATE my_articles a
LEFT JOIN categorylinks cl ON a.pageid = cl.cl_from
      SET a.importance = 'High'
    WHERE cl.cl_to = 'High'

The problem is, I don't have a UPDATE right for开发者_如何学JAVA the categorylinks table (I do have that right for my_articles), so the query fails with the message

 UPDATE command denied to user 'svick'@'willow.toolserver.org' for table 'categorylinks'

How can I work around this?


I would do it with Select inside Update.

Something like that (not tested):

UPDATE my_article a
SET a.importance = 'High'
WHERE a.page_id IN(SELECT cl.cl_from FROM categorylinks cl WHERE cl.cl_to='High')
0

精彩评论

暂无评论...
验证码 换一张
取 消