运行多个update t_contact_person set i_is_default = 1 where i_cp_identifier = 16628 ; update t_contact_person set i_is_default = 1 where i_cp_identifier = 23045 ; update t_contact_person set i_is_default = 1 where i_cp_identifier = 15100 ; update t_contact_person set i_is_default = 1 where i_cp_identifier = 14816 ; > Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1Affected rows:这样的结果对吗
时间: 2024-02-05 14:04:32 浏览: 33
这个结果看起来不对。如果你运行多个update语句,命令行客户端会对每个语句进行单独的计数,并输出每个语句的结果,但是这些结果不会合并成一个总的结果。因此,你最后看到的结果中只包含了最后一个update语句的结果。
如果你想要知道所有update语句的结果,你可以在SQL语句前面添加一个计数器命令,例如:
```
SELECT ROW_COUNT();
-- 这里是你的SQL语句
```
这个命令会返回一个整数,表示SQL语句更新的行数总和。
相关问题
怎么才能做到一次执行多个SQL语句,为什么会出现这种情况:update t_contact_person set i_is_default = 1 where i_cp_identifier = 14889; update t_contact_person set i_is_default = 1 where i_cp_identifier = 19110; > Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1
一次执行多个SQL语句可以使用分号(;)将它们分隔开来,然后一次性执行整个包含多个SQL语句的脚本。例如,使用MySQL的命令行工具,可以通过以下方式执行包含多个SQL语句的脚本:
```
mysql -u username -p database_name < script.sql
```
其中,script.sql是包含多个SQL语句的脚本文件。在执行脚本时,MySQL会一次性执行整个脚本,包含在其中的多个SQL语句都会被执行。
至于出现“Affected rows: 1Affected rows: 1Affected rows: 1Affected rows: 1”的情况,可能是因为每个SQL语句都只更新了一行数据,所以每个SQL语句执行后,都会返回“Affected rows: 1”的结果。如果每个SQL语句更新的行数不同,那么在执行后的结果中,会显示每个SQL语句更新的行数。例如,如果第一个SQL语句更新了3行数据,第二个SQL语句更新了2行数据,那么执行后的结果可能会是这样的:
```
Affected rows: 3
Affected rows: 2
```
这些信息可以用来检查SQL语句是否正确执行,并了解每个SQL语句更新了多少行数据。
error in :' ON DUPLICATE KEY UPDATE is_check ', expect IDENTIFIER, actual IDENTIFIER
error in :'ON DUPLICATE KEY UPDATE is_check', expect IDENTIFIER, actual IDENTIFIER 这个错误提示是因为在语法中使用了错误的标识符。可能是由于表名中包含特殊字符导致的。解决方案是给表名加上单引号,即使用`而不是'。这样可以解决该错误。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![none](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)