authorname rq qdsj xbsj
乌玉兰 2011-07-04 2011-07-04 09:00:11
乌玉兰 2011-07-04 2011-07-04 16:26:00查出结果:authorname rq qdsj xbsj
乌玉兰 2011-07-04 2011-07-04 09:00:11 2011-07-04 16:26:00
mysql语句查询
乌玉兰 2011-07-04 2011-07-04 09:00:11
乌玉兰 2011-07-04 2011-07-04 16:26:00查出结果:authorname rq qdsj xbsj
乌玉兰 2011-07-04 2011-07-04 09:00:11 2011-07-04 16:26:00
mysql语句查询
from 你的表
group by authorname, rq
select a.authorname,a.rq,a.qdsj,b.xbsj from tt a
inner join tt b on a.authorname=b.authorname and a.rq=b.rq and a.qdsj<b.xbsj
authorname rq qdsj xbsj 4个字段
乌玉兰 | 2011-07-04 | 2011-07-04 | 09:00:11
还是只有3个字段
乌玉兰 | 2011-07-04 | 2011-07-04 16:26:00如果3个字段,第三个字段叫sj
select authorname, rq, min(sj) as qdsj , max(sj) as xbsj
from table
group by authorname, rq如果4个字段,那么后面3个日期/时间型字段什么关系
inner join tt b on a.authorname=b.authorname and a.rq=b.rq and a.qdsj<b.qdsj and a.xbsj<b.xbsj
from table1
group by authorname,rq