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.
Declare @StatCode int
Set @StatCode = 8
select (select COUNT(Distinct(VisitorID))+.0
where VisitorID in(select VisitorID
where StatCode = @StatCode))/(select COUNT(*) from Stats where StatCode = @StatCode)