Where did I succesfully close voted

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- userid: your user id on the site "found in the url of your profile"
-- sd: Start date "yyyy-mm-dd format"
-- ed: End date "yyyy-mm-dd format"

declare @userid int = ##userid:int##
declare @sdate nvarchar(10) = ##sd:string##
declare @edate nvarchar(10) = ##ed:string##
declare @startdate date = cast(@sdate as date)
declare @enddate date = cast(@edate as date)
declare @userwithid nvarchar(20) = '"Id":' + cast(@userid as nvarchar) + ','

print @userwithid

select  cast(creationdate as date)
     , count(*) as total
     , sum(case 
     when Charindex(@userwithid, [text] )>0 then 1
     else 0
     end) as [user]
                
from posthistory
where posthistorytypeid = 10
and creationdate between @startdate and @enddate
group by cast(creationdate as date)
order by cast(creationdate as date)

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results