1、order by 时间 desc 不分组的显示
2、group by 时间 then select * from table where time= $time order by id desc 分组显示。
期待更好的解决方法。
2、group by 时间 then select * from table where time= $time order by id desc 分组显示。
期待更好的解决方法。
222222222
3333333332007-04-082222222222
3333333333
4444444444这样的效果 请教如何得到上述效果?
意思就是说你先把日期取出来,然后循环读取相应日期对应的数据。
----------------------------------------------
只需排序(order),不要分组(group)如果数据据量大可以分二次查询
假如有十条日期
$row=搜索得到的时间
for($i=0;$i<10;$i++)
{
select title from XXX where time=$row[0]
//然后再循环列出在该时间段的记录
}
222222222
3333333332007-04-082222222222
3333333333
4444444444-------------------
order by time desc 就可以了
得到的数据是这样的
111111111 2007-04-09
222222222 2007-04-09
333333333 2007-04-09
2222222222 2007-04-08
3333333333 2007-04-08
4444444444 2007-04-08