select t1.user_id, t1.username, t2.phone_number from 表1 as t1 left join 表2 as t2 on t1.user_id=t2.user_id
SELECT SUBSTRING_INDEX(name, '=', 1) AS city, SUBSTRING_INDEX(name, '=', -1) AS name FROM TB_USER上面那个是用于查询的,如果是想修改数据库,则用下面的语句:
ALTER TABLE TB_USER
ADD COLUMN city VARCHAR(16) NULL
UPDATE TB_USER SET city = SUBSTRING_INDEX(name, '=', 1),
name = SUBSTRING_INDEX(name, '=', -1)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)