首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

SQL 语句出错`这里人多`在线揭贴`解决思路

2012-03-20 
SQL 语句出错``````这里人多``在线揭贴`selectseqn_num,subject,to_char(Execute_time, hh24:mi:ss ),text

SQL 语句出错``````这里人多``在线揭贴`
select   seqn_num,subject,to_char(Execute_time, 'hh24:mi:ss '),text,is_finish   from   t_mission   where     to_char(Execute_time, 'hh24 ')=8   and   to_date(to_char(Execute_time, 'yyyy-mm-dd '), 'yyyy-mm-dd ')=to_date( '2007-7-15 ', 'yyyy-mm-dd ')   order   by   Execute_time

当我这样执行的时候是对的``   我要去掉subject重复的怎么写?

select     seqn_num,distinct   subject,to_char(Execute_time, 'hh24:mi:ss '),text,is_finish   from   t_mission   where     to_char(Execute_time, 'hh24 ')=8   and   to_date(to_char(Execute_time, 'yyyy-mm-dd '), 'yyyy-mm-dd ')=to_date( '2007-7-15 ', 'yyyy-mm-dd ')   order   by   Execute_time     是错的```


[解决办法]
非技術版?
[解决办法]
select seqn_num,subject,to_char(Execute_time, 'hh24:mi:ss '),text,is_finish
from t_mission t
where to_char(Execute_time, 'hh24 ')=8 and to_date(to_char(Execute_time, 'yyyy-mm-dd '), 'yyyy-mm-dd ')=to_date( '2007-7-15 ', 'yyyy-mm-dd ')
--and (select count(subject) from t_mission where t.subject=subject)=1 加上这句试试
order by Execute_time
[解决办法]
转到oracle版吧

问题也许没说清楚,去掉subject重复,其他字段怎么取,说清楚解决起来快点,事半功倍

热点排行