我想将表A中的注册表数量计算为表B中确定的特定时间。
我正在寻找正确的方法来做这样的事情:
SELECT count(*) as total
from table_a as a
WHERE a.created >= '0000-00-00 00:00:00'
AND a.created <= (SELECT table_b.end WHERE table_b.id = 13)
基本上,table_b由3列组成:一个名为'id'的int主键,一个名为'start'的日期时间和另一个名为'end'的日期时间。这就是我确定本年度所有星期的方式。
万一有人需要,这是执行此操作的正确方法:
SELECT count(*) as total
from table_a as a
WHERE a.created >= '0000-00-00 00:00:00'
AND a.created <= (SELECT table_b.`end` FROM table_b WHERE table_b.`id`=13)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句