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

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

我想查询出每天数据的最大的一个值。表的格式如下
表名: hisdata
字段 编号 值 状态 时间  
  Id value state dattime  
  101 32.3 0 2010-4-7 12:34:56
  102 19.2 1 2010-4-7 12:34:46
  103 23.2 0 2010-4-7 14:21:02
  101 32.3 0 2010-4-7 15:13:31
  102 19.2 1 2010-4-7 15:28:24
  103 23.2 0 2010-4-7 15:27:46
  --- ---- -- ------
  --- ----- --- ------
  101 32.3 0 2010-4-10 7:56:24
  102 19.2 1 2010-4-10 7:31:32
  103 23.2 0 2010-4-10 8:19:15

  比如要查询2009年4月7日和4月10日之间 编号为101的每天数据的最大值,如何写查询语句 谢谢




up.

SQL code:
select max(value) as maxValue,convert(varchar(10),[dattime],120) as [date]
from hisdata
where convert(varchar(10),[dattime],120) between '2009-04-07' and '2009-04-10'
and Id=101
group by convert(varchar(10),[dattime],120)


select top 1 datetime from testtable4 where Id='101' and convert(datetime,datetime1) between convert(datetime,'2010-04-07 12:00:00') and conve


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

数据以xml格式返回 - MS-SQL Server / 应用实例

从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
   <folder state="unchecked&qu ......

求一个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 ......

两句SQL并一句,有问题. - MS-SQL Server / 基础类

第一句:
select ht.gfdm,gfdm.gfmc,gfdm.lb ,sum(jh.htdj*jh.htsl)as je
from ht left join gfdm on ht.gfdm=gfdm.gfdm 
 join jh on ht.htbh=jh.hth 
and ht.htbh not like'del%' and ht. ......

关于SQL查询语句的问题 - MS-SQL Server / 疑难问题

请问如何实现如下查询
数据如下:
id name level
1 甲 1
2 甲 2
3 乙 1
4 乙 2
5 乙 3
6 丁 2
希望结果如下:
name level count
甲 1 1/2
甲 2 1/3
乙 1 1/2
乙 2 1/3
乙 3 1
丁 2 1/3
拜托了:) ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号