help optimize sql query
        Posted  
        
            by msony
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by msony
        
        
        
        Published on 2010-06-10T04:20:21Z
        Indexed on 
            2010/06/10
            4:32 UTC
        
        
        Read the original article
        Hit count: 369
        
I have tracking table tbl_track with id, session_id, created_date fields
I need count unique session_id for one day
here what i got:
select count(0) 
from (
       select distinct session_id
       from tbl_track 
       where created_date between getdate()-1 and getdate()
       group by session_id
)tbl
im feeling that it could be better solution for it
© Stack Overflow or respective owner