通过计算从 SELECT 更新
我正在尝试按照 这个 SO 线程
它不起作用。我想知道是否是因为我在执行计算时需要不同的 UPDATE...SELECT 结构。
我尝试过以下各种版本:
UPDATE tbl_usertime uat
SET uat.delay_qual = (TIMESTAMPDIFF(MINUTE, uat.view_date, '2011-10-11 15:22:25') > adt.delay),
freq_qual = (adt.frequency > uat.imps_today)
FROM tbl_timing adt
JOIN tbl_usertime uat
ON uat.ad_id = adt.ad_id;
...但它返回“SQL 语法错误...靠近 'FROM tbl_timing adt JOIN tbl_usertime uat”
有什么想法吗? 谢谢!
I'm trying to do an UPDATE
from a SELECT
following the format given by this SO thread
It's not working. I'm wondering if it's because I need a different UPDATE...SELECT structure when performing calculations.
I've tried various versions of the following:
UPDATE tbl_usertime uat
SET uat.delay_qual = (TIMESTAMPDIFF(MINUTE, uat.view_date, '2011-10-11 15:22:25') > adt.delay),
freq_qual = (adt.frequency > uat.imps_today)
FROM tbl_timing adt
JOIN tbl_usertime uat
ON uat.ad_id = adt.ad_id;
...but it returns 'error in SQL syntax...near 'FROM tbl_timing adt JOIN tbl_usertime uat'
Any ideas?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MySQL 语法有点不同,试试这个:
The MySQL syntax is a little bit different, try this:
我不确定它是否有效,但阅读 MySQL 文档给我的印象可能是有效的:
I am not sure it will work, but reading MySQL documentation gives me the impression that may be valid: