0
我有需要在一个计算值WHERE语句的查询:在计算值上优化SQL查询?
select * from table where date(timestamp) = ?
的这个查询说明产生预期的所有选择类型,这是不理想的。使用MySQL,优化这个最好的方法是什么?
我有需要在一个计算值WHERE语句的查询:在计算值上优化SQL查询?
select * from table where date(timestamp) = ?
的这个查询说明产生预期的所有选择类型,这是不理想的。使用MySQL,优化这个最好的方法是什么?
另一种选择可能是重写查询,以便计算全部在方程的另一端完成。例如:
timestamp >= <some date> AND timestamp < <some date + 1>
在此查询中,“some date”将是该日期的午夜。
select * from table where timestamp = UNIX_TIMESTAMP('?');