If you are just looking for Unique Visitors count, please try this:SELECT COUNT(DISTINCT post_visid_high, post_visid_low) AS count_uv FROM FROM DB.tableWHERE date_time BETWEEN ('2017-11-08 00:00:00') AND ('2017-11-08 11:59:59') AND exclude_hit = 0AND hit_source NOT IN (5,7,8,9);