表T中有N条记录。每条记录都有时间间隔 - startTime,endTime,采用unix时间戳格式。我想生成一个从最低startTime到Now的时间间隔列表(开始+结束时间),其中没有记录在那时有时间间隔。如何用MySQL做这件事?
拥有this等数据 我们想获得价值
(3, 4)
(9, 10)
(13, NOW())
答案 0 :(得分:0)
除非我遗漏了某些内容,否则“间隙”的最大数量等于您拥有的时间间隔数。
考虑到这一点,这是我对你的问题的尝试:
ORDER BY
查看Fiddle。
编辑:忘记<?php if(($rowCount % 3) == 0) { ?>
<?php if($count > 6) { echo "-->"; ?>
</div><!-- End lazy load div -->
<?php } ?>
</div><!-- End product centering -->
</div><!-- End row -->
<?php if($rowClass == "internal-product-light"){ $rowClass = "internal-product-dark";}else{$rowClass = "internal-product-light";}
} ?>
条款。