时间:2021-05-23
去掉数据重复
增加两个字段
alter TABLE T_Employee Add FSubCompany VARchar(20);
ALTER TABLE T_Employee ADD FDepartment VARCHAR(20);
给新加的字段赋值
UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='Development' where FNumber='DEV001';
UPDATE T_Employee SET FSubCompany='ShenZhen',FDepartment='Development' where FNumber='DEV002';
UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='HumanResource' where FNumber='HR001';
UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='HumanResource' where FNumber='HR002';
UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='InfoTech' where FNumber='IT001';
UPDATE T_Employee SET FSubCompany='ShenZhen',FDepartment='InfoTech' where FNumber='IT002';
UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='Sales' where FNumber='SALES001';
UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='Sales' where FNumber='SALES002';
UPDATE T_Employee SET FSubCompany='ShenZhen',FDepartment='Sales' where FNumber='SALES003';
查询并去重
select distinct FDepartment from T_Employee
select distinct FDepartment,FSubCompany from T_Employee
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
本文实例讲述了JS学习笔记之数组去重实现方法。分享给大家供大家参考,具体如下:操作的数组letarr=[0,1,23,'1',4,2,8,5,5,6,9,'as
前言增加字段相信大家应该都不陌生,随手就可以写出来,给MySQL一张表加字段执行如下sql就可以了:ALTERTABLEtbl_tplADDtitle(255)
mysql查询的控制语句字段去重**关键字:distinct**语法:selectdistinct字段名from表名;案例:对部门进行去重Selectdisti
本文实例讲述了mysql学习笔记之完整的select语句用法。分享给大家供大家参考,具体如下:本文内容:完整语法去重选项字段别名数据源wheregroupbyh
rank是T_sql函数,rank()函数返回结果集分区内指定字段的值的排名,指定字段的值的排名是相关行之前的排名加一。 T-SQL即Transact-SQL