表1
序号 姓名 入职时间 离职时间 id
1 f 2000 2010 156
2 d 1999 null null
3 j 1998 null null序号为主键(自增长)update 表1 set id='123' 离职时间=SYSDATE() where id=null 并且 序号为最小的一个红色部分为where的条件,实现找到一个id为空的唯一的一行,最大或最小无所谓
序号 姓名 入职时间 离职时间 id
1 f 2000 2010 156
2 d 1999 null null
3 j 1998 null null序号为主键(自增长)update 表1 set id='123' 离职时间=SYSDATE() where id=null 并且 序号为最小的一个红色部分为where的条件,实现找到一个id为空的唯一的一行,最大或最小无所谓
解决方案 »
- MySQL的check约束只是一个摆设,不起作用,那岂不是很不方便,得在应用程序中去实现check
- 这个UNION 是什么情况...
- 请教postgresql dblink ,在本地数据库中根据本地表数据,同步远程数据库表中的数据的问题,谢谢
- mysql导入库的错误
- 写一个查询语句,看你会不会!!!!!!
- 我用postgres数据库,创建了一个表,create table networkstat (cur_time time,s1 char(8),s2 char(8),s3 char(8)),
- ◆请问“where f3 & 17 = 0”是啥意思啊?
- postgres的编码问题
- mysql不能建立数据库
- 各位高手,有人喜欢用mysql吗?谈谈这个东东吧
- 这条语句哪里错了?
- 请各为大虾帮忙解决一个问题。。。
update 表1 set id='123' 离职时间=SYSDATE() where 序号=(select min(序号) from 表1 where )
ERROR 1093 You can't specify target table 'forum_members' for update in FROM clause
set id='123',离职时间=SYSDATE()
MySQL Data Transfer
Source Host: localhost
Source Database: zlink
Target Host: localhost
Target Database: zlink
Date: 2010-11-23 23:29:32
*/SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for ctcm_en_didmanage
-- ----------------------------
CREATE TABLE `ctcm_en_didmanage` (
`DIDID` int(50) NOT NULL AUTO_INCREMENT,
`DIDNUMBER` varchar(100) NOT NULL,
`DIDINTIME` date NOT NULL,
`DIDSTATE` varchar(100) NOT NULL DEFAULT '0',
`DIDOUTTIME` datetime DEFAULT NULL,
`ID` varchar(100) DEFAULT NULL,
PRIMARY KEY (`DIDID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `ctcm_en_didmanage` VALUES ('1', '1212121', '2010-11-23', '0', null, '2088888888');
INSERT INTO `ctcm_en_didmanage` VALUES ('2', '3333344555', '2010-11-08', '0', null, '2010000003');
INSERT INTO `ctcm_en_didmanage` VALUES ('3', '658809', '2010-11-23', '1', '2010-11-23 23:09:53', '2010000004');
INSERT INTO `ctcm_en_didmanage` VALUES ('4', '5787890', '2010-11-23', '0', null, null);
INSERT INTO `ctcm_en_didmanage` VALUES ('5', '43434343', '2010-11-23', '0', null, null);
update ctcm_en_didmanage a inner join (select min(DIDID) as im from ctcm_en_didmanage where ID=null) b on a.DIDID=b.im set ID = '2010000004', DIDSTATE = '1', DIDOUTTIME = SYSDATE()
表及sql语句如上,能够执行,但没有影响任何行
影响的数据栏: 0
时间: 0.000ms
set DIDOUTTIME=SYSDATE()
where id is null order by DIDID limit 1