select distinct

select [color=red]distinct[/color] vst_small_id,[color=red]upload_day + ' '+ upload_time [/color]from vst_small [color=red]order by [/color]upload_day desc,upload_time desc;
服务器: 消息 145,级别 15,状态 1,行 1
[color=red]如果指定了 SELECT DISTINCT,那么 ORDER BY 子句中的项就必须出现在选择列表中。[/color]

拆开写就好了,比较一下这两条语句的异同
select distinct vst_small_id,[color=red]upload_day , upload_time [/color]from vst_small order by upload_day desc,upload_time desc;

你可能感兴趣的:(sqlserver)