永发信息网

求写一个MYSQL替换语句,使得2个字段的值相等

答案:1  悬赏:80  手机版
解决时间 2021-03-03 16:31
  • 提问者网友:城市野鹿
  • 2021-03-03 11:52
表一:pre_forum_thread 字段一:tid 字段二:subject
表二:pre_forum_typeoptionvar 字段一:tid 字段二:value 字段三:optionid
怎么才能实现将表一的字段二和表二的字段二相同
附加2个条件:
1、两个表的字段一tid相同(tid是序号)
2、字段三:optionid的值是33的行进行替换
最佳答案
  • 五星知识达人网友:山有枢
  • 2021-03-03 12:53
update pre_forum_typeoptionvar set value = (select subject form pre_forum_thread where pre_forum_thread.tid = (select tid from pre_forum_typeoptionvar where optionid=33))
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯