mysql update和select连用语句

UPDATE t_product_company_record b

		inner join (
select (


	 
		SELECT
			id
		FROM
			t_product_user
		WHERE
			username = SUBSTRING(
				t.content,
				1,
				LOCATE('注册了', t.content) - 1
			)
	) AS userid,
	t.id
FROM
	t_product_company_record t) c on b.id=c.id


SET b.userid = c.userid where  isnull(b.userid)

mysql update和select连用语句

需求:
默认我company_record这张表userid为空,需要用content内容中的用户名去用户表匹配,拿到id赋值到这张表的userid这一列。

相关文章:

  • 2021-12-06
  • 2021-05-23
  • 2021-05-17
  • 2022-03-04
  • 2022-01-01
猜你喜欢
  • 2021-06-30
  • 2021-06-03
  • 2021-08-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
相关资源
相似解决方案