MySQL: Counting column from different tables on a certain timeframe -


i have following query:

select sum(counted) tcounted      (select counted `clicks`.`t1`           union           select counted `clicks`.`t2`           union           select counted `clicks`.`t3`          ) tmp 

where , how add time constraint? want count between dates... sorry mysql noobness.

thanks!

select sum(counted) tcounted      (select counted `clicks`.`t1` somedatecol between somedate , somedate           union           select counted `clicks`.`t2` somedatecol between somedate , somedate           union           select counted `clicks`.`t3` somedatecol between somedate , somedate          ) tmp` 

http://dev.mysql.com/doc/refman/5.0/en/select.html


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -