我有这张桌子:
pedido data
314 2013-04-05 00:00:00.000
318 2013-04-05 00:00:00.000
319 2013-04-05 00:00:00.000
26025 2013-07-01 00:00:00.000
26026 2013-07-01 00:00:00.000
26026 2013-07-01 00:00:00.000
26026 2013-07-01 00:00:00.000
26026 2013-07-01 00:00:00.000
26027 2013-07-01 00:00:00.000
26029 2013-07-01 00:00:00.000
26029 2013-07-01 00:00:00.000
我想要这个结果:
314 2013-04-05
318 2013-04-05
319 2013-04-05
26025 2013-07-01
26026 2013-07-01
26027 2013-07-01
26029 2013-07-01
我尝试过这个但不工作:
select pedido,data from alteraca group by data,pedido order by pedido
还有这个 :
select pedido, (CONVERT varchar(10),data,101) as fecha1 from alteraca
这段代码对我有用:
select pedido, MIN (data) as data from alteraca
group by pedido order by pedido
一个小细节我如何只显示日期部分
14 2013-04-05
318 2013-04-05
不是
14 2013-04-05 00:00:00.000
318 2013-04-05 00:00:00.000