I made MSSQL query that calculates total unique IP address and total IP records for past 30 days.
SELECT count(IPAddress) AS totalPageHits, count(DISTINCT IPAddress) AS totalVisitors, count(DateTime)
FROM recordTable
WHERE DateTime > GETDATE()-30
Now I am having a hard time to calculate average daily page hits and average daily unique visitors.
I have tried to use AVG but it gives me an error message saying “Operand data type varchar is invalid for avg operator.”
Any help is greatly appreciated.
1 Answer