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

这句select TIMEDIFF() 能否简化
select TIMEDIFF(
(select dateT from phpTime where id=(select max(id) from phpTime)),
(select dateT from phpTime where id=(select max(id)-1 from phpTime)))
 
max(id)的时间 减去 (max(id)-1)的时间

请高手帮我看看能否再简化点!

------解决方案--------------------
没什么可简化的了。 换成其它的 limit 1, not exist 应该还不如你的这个快。
------解决方案--------------------
这种方案已经是最优的。