创建表
CREATE TABLE `field_data` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `name` varchar(255) DEFAULT NULL COMMENT '名称', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8;
插入数据
INSERT INTO `field_data` VALUES (1, '第1条数据'); INSERT INTO `field_data` VALUES (2, '第2条数据'); INSERT INTO `field_data` VALUES (3, '第3条数据'); INSERT INTO `field_data` VALUES (4, '第4条数据'); INSERT INTO `field_data` VALUES (5, '第5条数据'); INSERT INTO `field_data` VALUES (6, '第6条数据');
指定字段值排序
select * from field_data order by id; --普通排序 select * from field_data order by field(id,3,5) desc,id desc; --指定字段值排序
标签:INSERT,INTO,指定,field,VALUES,mysql,排序,data,id From: https://www.cnblogs.com/boye169/p/16827717.html