I'm working with a really simple query that pulls data to show all visitors to a certain location within a given time frame.
SELECT VisitID, UserID, UserName, VisitDate
From Visit
WHERE VisitDate BETWEEN '04/01/2016' AND '04/03/2016'
And of course I get results like so:
VisitID     UserID     UserName         VisitDate
----------------------------------------------------
0001        1234       John Smith       04/01/2016
0002        3456       Jane Doe         04/01/2016
0003        6789       Mike Jones       04/02/2016
0004        1234       John Smith       04/02/2016
0005        4567       Bob Brown        04/02/2016
0006        3456       Jane Doe         04/03/2016
0007        1234       John Smith       04/03/2016
Now what I need to do is only select the users who had 2 or more visits during the given time period, so in this particular example, I wouldn't want Mike Jones and Bob Brown because they only had 1 visit. I'm not entirely sure how to go about this. I was thinking it would be something along the lines of declaring a variable, setting that variable to equal a COUNTof VisitID, and then adding a WHERE clause with COUNT(VisitID) >= 2. But I'm not sure about the syntax. Am I on the right track? How would I filter these results by only visitors with multiple visits?
 
     
    