Jump to content

Advance "distinct"

Recommended Posts

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

Edited by khadem1386
  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...