Hello, I was wondering how I can modify the sql query I have below so that instead of setting @StatCode manully each time It would select all of the StatCodes in a table and complete the operation below for each one.
The table and field which contains the StatCode values is StatSource.StatCode. I tried to do this myself but was unable to work through it. Hopefully after I see it done one more time i will be able to do it myself!
Declare @StatCode int
Set @StatCode = 8
select COUNT(VisitorID) As Clicks, COUNT(Distinct(VisitorID)) As UniqueVisitors
where VisitorID in(Select VisitorID from InboundTraffic where StatCode = @StatCode)