i want group every minute between date1 , date2 in following query. 0 values should displayed. every minute between dates should displayed. problem dates doesn't exist in table.
select click.date 'date', count(*) click inner join short_url surl on click.short_url_id = surl.id inner join article_surl on article_surl.article_id = 3 click.date between (?date1:'2011-04-24 13:33:00') , (?date2:'2011-04-24 15:33:00') group date_format(click.date, '%y-%m-%d %h:%i:00');
i think way make temporary table? performance hits of this? join on date isn't good, because click.date may have milliseconds in datetime. dateformat should used? maybe better in application logic, read array , fill in missing dates 0 values.
i think suggestion of filling in missing values in application logic best bet avoid creating temp table, if processing array anyways. same thing in of our services we've written.
Comments
Post a Comment