create table tb_sequence(id int auto_increment not null ,primary key(id) );
insert into tb_sequence values(),(),(),(),(),(),(),(),(),(),(),(),();
                insert into tb_sequence values(),(),(),(),(),(),(),(),(),(),(),(),();
                    
                    2016-08-05
                
            删除重复行,并保留id最大的:
DELETE a
FROM user1_test a JOIN
(SELECT user_name, COUNT(*), MAX(id) AS id FROM user1_test GROUP BY user_name HAVING COUNT(*)>1) b
ON a.user_name = b.user_name
WHERE a.id < b.id;
                DELETE a
FROM user1_test a JOIN
(SELECT user_name, COUNT(*), MAX(id) AS id FROM user1_test GROUP BY user_name HAVING COUNT(*)>1) b
ON a.user_name = b.user_name
WHERE a.id < b.id;
                    
                    2016-07-29
                
            SELECT user_name, 'arms' AS equipment, arms FROM user1 a JOIN user1_equipment b ON a.id = b.user_id
UNION ALL
SELECT user_name, 'clothing' AS equipment, arms FROM user1 a JOIN user1_equipment b ON ...
UNION ALL
SELECT user_name, 'shoe' AS equipment, arms FROM user1 a JOIN user1_equipment b ON ...
                UNION ALL
SELECT user_name, 'clothing' AS equipment, arms FROM user1 a JOIN user1_equipment b ON ...
UNION ALL
SELECT user_name, 'shoe' AS equipment, arms FROM user1 a JOIN user1_equipment b ON ...
                    
                    2016-07-28
                
            SELECT user_name, arms, clothing, shoe FROM user1 a JOIN user1_equipment b ON a.id = b.user_id;
                
                    
                    2016-07-28
                
            INSERT INTO user1_equipment VALUES (NULL, 3, '金箍棒', '梭子黄金甲', '藕丝步云履');
INSERT INTO user1_equipment VALUES (NULL, 2, '九齿钉耙', '僧衣', '僧鞋');
INSERT INTO user1_equipment VALUES (NULL, 4, '降妖宝杖', '僧衣', '僧鞋');
INSERT INTO user1_equipment VALUES (NULL, 1, '九环锡杖', '锦斓袈裟', '僧鞋');
                INSERT INTO user1_equipment VALUES (NULL, 2, '九齿钉耙', '僧衣', '僧鞋');
INSERT INTO user1_equipment VALUES (NULL, 4, '降妖宝杖', '僧衣', '僧鞋');
INSERT INTO user1_equipment VALUES (NULL, 1, '九环锡杖', '锦斓袈裟', '僧鞋');
                    
                    2016-07-28
                
            CREATE TABLE user1_equipment (
id TINYINT UNSIGNED AUTO_INCREMENT NOT NULL,
user_id SMALLINT UNSIGNED,
arms VARCHAR(10) CHARACTER SET utf8 DEFAULT NULL,
clothing VARCHAR(10) CHARACTER SET utf8 DEFAULT NULL,
shoe VARCHAR(10) CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY(id)
);
                id TINYINT UNSIGNED AUTO_INCREMENT NOT NULL,
user_id SMALLINT UNSIGNED,
arms VARCHAR(10) CHARACTER SET utf8 DEFAULT NULL,
clothing VARCHAR(10) CHARACTER SET utf8 DEFAULT NULL,
shoe VARCHAR(10) CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY(id)
);
                    
                    2016-07-28
                
            回复前面同时后来人估计也会有的疑问:我难道只能一行行写?回答是:这是开发技巧!如果你有几百行几百列的数据要行列转换,那不叫开发叫维护,至于怎么维护……你问我?我告诉你,导出成excel不就行了么,然而导出不是开发时的主要问题了
                
                    
                    2016-07-18
                
            
                                最新回答 / qq__2964
                                
                                                            这是理想状态,一般一个程序写好了,基本都不会去怎么修改了,除了客户强烈要求修改业务外(不改不付钱啊这些),开发基本不会动程序,都是让实施人员从数据库中动刀子,这就是现状,让你加过程啊,做报表啊。。。
                            
                        
                        2016-07-16
                
             
             
        







