gpt4 book ai didi

mysql - = 和 := in MySQL 之间的区别

转载 作者:行者123 更新时间:2023-11-29 04:06:15 25 4
gpt4 key购买 nike

MySQL 中,这两个命令有什么区别?

它们工作得很好,结果总是一样的:

set @numRecords = (select count(*) from config);

set @numRecords := (select count(*) from config);

谢谢大卫

最佳答案

引用 MySQL 5.7 引用手册,section 10.4 User-Defined Variables :

For SET, either = or := can be used as the assignment operator.

You can also assign a value to a user variable in statements other than SET. In this case, the assignment operator must be := and not = because the latter is treated as the comparison operator = in non-SET statements

关于mysql - = 和 := in MySQL 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37869719/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com