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

求SQL - MS-SQL Server / 基础类

SQL code:

create table tt
(
msgid int,
logdate datetime,
msg varchar(20)
)
insert into tt
select 1,'2010-05-05 08:30:00.000','hello' union all
select 1,'2010-05-05 09:05:08.000','aaaa' union all
select 1,'2010-05-05 09:30:00.000','bbbb' union all
select 1,'2010-05-05 10:30:00.000','over' union all
select 2,'2010-05-05 10:08:00.000','send' union all
select 2,'2010-05-05 10:10:00.000','accept' union all
select 3,'2010-05-05 11:10:00.000','end'

结果
--------------------------------------------------------------------------------------------------------------
1 hello 2010-05-05 08:30:00.000 aaaa 2010-05-05 09:05:08.000 bbbb 2010-05-05 09:30:00.000 over 2010-05-05 10:30:00.000
2 send 2010-05-05 10:08:00.000 accept 2010-05-05 10:10:00.000
3 end 2010-05-05 11:10:00.000



SQL code:
create table tt
(
msgid int,
logdate datetime,
msg varchar(20)
)
insert into tt
select 1,'2010-05-05 08:30:00.000','hello' union all
select 1,'2010-05-05 09:05:08.000','aaaa' union all
select 1,'2010-05-05 09:30:00.000','bbbb' union all
select 1,'2010-05-05 10:30:00.000','over' union all
select 2,'2010-05-05 10:08:00.000','send' union all
select 2,'2010-05-05 10:10:00.000','accept' union all
select 3,'2010-05-05 11:10:00.000','end'


相关问答:

求一个SQL语句 - MS-SQL Server / 基础类

字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......

请教SQLSERVER的两个问题 - MS-SQL Server / 疑难问题

1。怎样使xp_cmdshell能完整输出超过255个字符的字符串。
2。select 时,检索速度是与from后的 TABLE顺序有关,还是与where条件的顺序有关(TABLE数据多少 )
在系统属性设定里有个选项,可以修改单字段输出字数限制. ......

请教SQL语句查询问题? - MS-SQL Server / 基础类

我想查询出每天数据的最大的一个值。表的格式如下
表名: hisdata
字段 编号 值 状态 时间  
  Id value state dattime  
  101 32.3 0 ......

SQL不明白 - MS-SQL Server / 应用实例

查询学生平均成绩及其名次 
  SELECT 1+(SELECT COUNT( distinct 平均成绩) 
  from (SELECT S#,AVG(score) AS 平均成绩 
  from SC&n ......

SQL 问题 - MS-SQL Server / 基础类

有2个数据表A与B,如何补充A中没有,B中有的数据,使A表数据完整?请写下具体源代码
SQL code:
insert A select * from A right join B on A.key=b.key where A.key is null


select * from B left join ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号