I am doing a query from an SQL database. The table has over a million records in it.
This is my SQL statement. It takes over 8 hours to run. Anyone have any ideas? Thanks in advance.
Select
Count (userID) as DIBWIZHits, Sum (ssnCount) as SSNs
From
tbl_hits10
Where
(appName='DIBwiz QMT' or
appName like 'DIBwiz-Full%' or
appName like 'DIBwiz-Abb%' or
appName like 'DIBwiz-Qual%')
-- or appName like 'DIBwiz%Open%' or appName like 'DIBwiz%Q%')
and
lu_date between
convert (datetime, '2010-09-01 00:00:00', 102) and
convert (datetime, '2010-09-30 23:59:59', 102)
AND
(userID<>'888888' and
userID<>'999999' and
userID<>'777777' and
userID<>'666666' and
)