sql 查询

[复制链接]
查看11 | 回复1 | 2009-10-30 14:37:55 | 显示全部楼层 |阅读模式
select distinct (select min([time]) from times where substring(convert(varchar(20),[time],121),0,11)=substring(convert(varchar(20),getdate(),121),0,11) and substring(convert(varchar(20),[time],121),12,8)'18:30:00')from times 已经试过,可以使用 time为时间列名,times为表名 这里面加了判断,只对当天日期有效,如果需要定点查某一天,把getdate()换成需要查询的当天日期就好
回复

使用道具 举报

千问 | 2009-10-30 14:37:55 | 显示全部楼层
用case语句就可以
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行