日期:2014-05-16  浏览次数:21143 次

access 中如何实现用group得出日期中的年-月 ?
数据库中数据:
================================================================
id_ dat_ tit_
212 2007-6-10 Dance   party   at   Sliver   moon   bar
213 2007-6-15 Dance   party   at   Sliver   moon   bar
214 2007-6-17 Dance   party   at   Sliver   moon   bar
215 2007-6-22 Dance   party   at   Sliver   moon   bar
216 2007-6-28 Dance   party   at   Sliver   moon   bar
217 2007-6-30 Dance   party   at   Sliver   moon   bar
218 2007-7-1 Dance   party   at   Sliver   moon   bar
219 2007-7-5 Dance   party   at   Sliver   moon   bar
220 2007-7-7 Dance   party   at   Sliver   moon   bar
221 2007-7-13 Dance   party   at   Sliver   moon   bar
222 2007-7-18 Dance   party   at   Sliver   moon   bar
223 2007-7-27 Dance   party   at   Sliver   moon   bar
224 2007-7-10 Dance   party   at   Sliver   moon   bar
225 2007-8-15 Dance   party   at   Sliver   moon   bar
226 2007-8-17 Dance   party   at   Sliver   moon   bar
227 2007-8-22 Dance   party   at   Sliver   moon   bar
228 2007-8-28 Dance   party   at   Sliver   moon   bar
229 2007-8-30 Dance   party   at   Sliver   moon   bar
230 2007-9-1 Dance   party   at   Sliver   moon   bar
231 2007-9-5 Dance   party   at   Sliver   moon   bar
232 2007-9-7 Dance   party   at   Sliver   moon   bar
233 2007-9-13 Dance   party   at   Sliver   moon   bar
234 2007-9-18 Dance   party   at   Sliver   moon   bar
235 2007-9-27 Dance   party   at   Sliver   moon   bar
236 2007-10-12 Dance   party   at   Sliver   moon   bar
237 2007-10-22 Dance   party   at   Sliver   moon   bar

=====================================================================


想得到结果:

2007-6
2007-7
2007-8
2007-9
2007-10

现在SQL语句:
sql_   =   "   select   dat_   from   [blog_]   group   by   dat_   order   by   dat_   desc   "

得到的是每一天的group,我是access+asp,请高手帮助!



------解决方案--------------------
sql_ = "
select format(dat_, 'yyyy-mm ')
from [blog_]
group by format(dat_, 'yyyy-mm ')
order by format(dat_, 'yyyy-mm ') desc "