SELECT sum(numlog) FROM table1 WHERE date IN (SELECT date from temptable)