易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL去除某一字段值重复记录的方法

原理:对需要去重复记录的字段按组排序,然后取其中一条记录。在总查询语句中使用in语法过滤
去掉重复记录
select * from company where comid in (select Max(comid) from company group by companyname)
得到重复记录数
select * from company where comid not in (select Max(comid) from company group by companyname)
对完全相同的记录可以使用DISTINCT 对记录进行唯一性过滤


相关文档:

sql 数据库中不同数据库中两表创建视图

 CREATE VIEW MYVIEW
AS
   SELECT * from bjxxdiweb_database2007.dbo.bm_tongji
    UNION ALL
SELECT * from aa.DBO.chen
select * into aa..chen from bjxxdiweb_database2007.dbo.bm_tongji where 1=2
说明:数据库A的表的字段名必须和数据库B的表的字段名相同,包括数据类型等。 ......

SQL语句PART10

oracle tips
Exist的用法:
select gw.ndocid from 
(select ndocid from wf_doc_gw_shouwen union select ndocid from wf_doc_gw_fawen) gw
where
not exists (select null from wf_doc_gw_sn sn where sn.ndocid=gw.ndocid)
2。把GW表和SN表里相同的NDOCID显示出来
select gw.ndocid from 
(se ......

SQL语句PART11


1. My test: (create and grant the sysdba to a new user by SQL*Plus)
CREATE USER FJTEST1 IDENTIFIED BY JEANJEANFANG;
GRANT SYSDBA TO FJTEST;
REVOKE SYSDBA from FJTEST;
CONNECT FJTEST1/JEANJEANFANG AS SYSDBA;
2. Using ORAPWD in windows:
C:\» ORAPWD;
(show help information)
3. to see th ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号