Home > Database > Mysql Tutorial > body text

数据-利用mysql内部机制执行运算问题

WBOY
Release: 2016-06-06 09:39:44
Original
911 people have browsed it

mysql数据

mysql有没有这样的一种机制,我想用前一条数据的结果,然后插入一条新的数据;
例如我这个表里有四个字段,分别是id,count0,count1,count2;我先查询到的前一条数据内容分别是id=1,count0=1,count1=2,count2=3;然后我要插入一条id=2新的数据count0和count1分别加1,count2不变(id=2,count0=2,count1=3,count2=3);如果按一般的思路,我先要查询id=1的数据,获取count0,count1,count2的值,然后再执行运算,这样好像有点浪费资源,
现在我想不经过查询,直接插入,利用mysql内部的机制直接运算,应该怎么做?

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