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

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -