查询是:
select sum(value)
from TAB
where TimeStamp=
{
select max(TimeStamp)
from TAB where col1=12 and col2=18
}
and col1=12 and col2=18;
我试图通过消除子查询来改进它。如果可能的话。
答案 0 :(得分:1)
试试这个:
select sum(value)
from TAB
where col1=12 and col2=18
group by TimeStamp
order by TimeStamp desc
limit 1