affiche_time降序排列。再取第一条就是了。select xxxxx orderby affiche_time desc

解决方案 »

  1.   

    1、建议将affiche_time的数据类型修改为datetime。
    2、如果实在要使用varchar,需要你的格式固定,即给定任意两条记录,一定能使用比较区别出那个时间在前哪个在后。
    Sql语句(这里取10条,可根据需要修改):
     select top 10 affiche_content from table_name order by affiche_time desc
      

  2.   

    我已经把affiche_time的数据类型修改为datetime了。那个affiche_time降序排列。再取第一条。是全是SQL中写吗?
     
    jsp上不用写什么了吗?
      

  3.   

    表现在是这样写的了
    create table newsaffiche
    (
       [affiche_content] [text] default '',    --公告的内容 
       [affiche_time] [datetime] NULL ,  --发公告的时间)那个在affiche_time降序排列怎么写?再取第一条怎么写?