khadem1386 Posted November 7, 2011 Share Posted November 7, 2011 Himy Table has about 1,000,000 Records that saved During 20 daysThese are my fields . that save Ip Of my visitor. ID , Date_server , IP"Date_server" is Date-time DATA TYPE Now I want count number of my visitors.so this is my query to count my VISITORs on '3-10-2011'. SELECT COUNT(distinct ip) AS [Number of visitors]FROM Table1where CONVERT(VARCHAR(10),(Date_server), 105) = '3-10-2011' It return 5700 Then I check by some another counters.They return 7600 After it I see that problem is "VISITOR" 's Meaning. this is my new rule-When an Ip(visitor) leave my site for more than 30 minutes. then he return to site , He is a new visitor.-But if he has not a gap large than 30 minutes. he is not a new visitor for my counter. What query you offer for me, instead "Distinct"?or is there any advance "Distinct"?or can we use advance "Where" or sub-query ? I need your code sample pleaseThanks for your time Link to comment Share on other sites More sharing options...
khadem1386 Posted November 8, 2011 Author Share Posted November 8, 2011 Is there any suggestion? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 8, 2011 Share Posted November 8, 2011 That's fairly complex. I would either create a stored procedure, or get all of the records in PHP and then figure out who's unique and who's not. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.