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

sql 实现记录有重复只显示一条。

col_1      col_2      col_3      col_4     
---------- ---------- ---------- ----------
a          111        222        333      
a          11         22         33       
b          111        222        333      
b          11         22         333      
需求: 实现如果col_1列的值出现相同, 只显示第一条.
结果:
col_1      col_2      col_3      col_4     
---------- ---------- ---------- ----------
a          111        222        333       
b          111        222        333        
如何去实现?


相关文档:

sql server创建数据库脚本

use master
go
--切换master数据库
if exists(select 1 from sysdatabases where name = N'test')
--注意该同名数据库是否还要用到
begin
drop database test
end
go
create database test
on
primary
( name = 'testprimary', --主数据文件逻辑名
filename = 'D:\testprimary.mdf',--主数据文件存放路径
......

SQL Server JDBC Deriver Problems

If the SQL data type is 'timestamp', we need to use ResultSet.getBytes() to retrieve its value. If the SQL data type is 'datetime', we can use ResultSet.getTimestamp(). It is said timestamp is interanlly saved as binary data.
  try {
     Class.forName("com.microsoft. ......

SQL数据库CTE的用法

在很多编程语言中都有 for循环这样的东西。在数据库里面 替代他是 游标
但是游标使用起来是相当耗费资源的,今天看见一个CTE尝试了下他的用法
create table employewhere
(
 id int identity(1,1),
 [name] varchar(10),
 [value] varchar(10),
 [ttime] int
)
insert employewhere
select ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号