Home > Database > Mysql Tutorial > body text

MySQL update select,update的同时select和for update语句_MySQL

WBOY
Release: 2016-06-01 13:35:19
Original
1318 people have browsed it

bitsCN.com

MySQL update select,update的同时select和for update语句

 

MySQL update && select

 

CREATE TABLE `testupdate` (

  `id` bigint(20) NOT NULL AUTO_INCREMENT,

  `val` bigint(20) NOT NULL DEFAULT '0',

  PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8

 

update testupdate

 

set val = val+1

 

where id = 1 and @value := val+1;

 

select @value;

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template