mysql 5.6 主从表访问_mysql中的主从表连接后更新的问题

MySQL 5.6 Schema Setup:

CREATE TABLE ForgeRock (

`id` INT,

`productName` VARCHAR (7),

`description` VARCHAR (55)

);

INSERT INTO ForgeRock (

`id`,

`productName`,

`description`

)

VALUES

(

1,

'OpenIDM',

'Platform for building enterprise provisioning solutions'

);

CREATE TABLE ForgeRock_Detail (

`detail_id` INT,

`fr_id` INT,

detail_description VARCHAR (55)

);

INSERT INTO ForgeRock_Detail (

detail_id,

fr_id,

detail_description

)

VALUES

(1, 1, 'dd1'),

(2, 1, 'dd2'),

(3, 1, 'dd3');

Query 1:

select * from ForgeRock

left join ForgeRock_Detail

on id=fr_id

Results:

| id | productName | description | detail_id | fr_id | detail_description |

|----|-------------|---------------------------------------------------------|-----------|-------|--------------------|

| 1 | OpenIDM | Platform for building enterprise provisioning solutions | 1 | 1 | dd1 |

| 1 | OpenIDM | Platform for building enterprise provisioning solutions | 2 | 1 | dd2 |

| 1 | OpenIDM | Platform for building enterprise provisioning solutions | 3 | 1 | dd3 |

就是一个mysql中的主从表,我现在想做的是连接后更新

UPDATE ForgeRock

LEFT JOIN ForgeRock_Detail ON id = fr_id

SET description = detail_description

现在的问题是,这条语句会不会执行三次对description的更新操作?

还有哦,这种语句有办法单步调试么?去看到底执行了几次操作。因为detail_description是不同的,如果description更新3个不同的值,应该是可以查到修改记录的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值