dataexplorer

How to paginate the badge table on SEDE?

假如想象 提交于 2021-01-28 08:14:24
问题 Having the code from this example: -- UserId: User ID "Enter a user's ID." SELECT u.Id AS [User Link] , CASE WHEN b.Tagbased = 1 THEN 'Tag: [' + b.Name + ']' ELSE b.Name END AS [Badge name] , CASE WHEN b.Class = 1 THEN 'Gold' WHEN b.Class = 2 THEN 'Silver' WHEN b.Class = 3 THEN 'Bronze' ELSE '*Unkown*' END AS [Class] , b.Date AS [Awarded] FROM Badges b LEFT JOIN Users u ON u.Id = b.Userid --WHERE b.Userid = ##UserId:int## WHERE u.reputation > 100000 ORDER BY u.Displayname , [Awarded] DESC How

Getting non-integer results in Data Explorer

[亡魂溺海] 提交于 2020-01-17 08:05:35
问题 The Stack Exchange Data Explorer allows SQL queries against a Stack Exchange database. The following query — select month(CreationDate) month, year(CreationDate) year, sum(case when lower(left(Title,2))='wh' then 1 else 0 end)/count(*) wh, (select sum(Score)/count(*) from Posts u where month(CreationDate)=month(t.CreationDate) and year(CreationDate)=year(t.CreationDate) and lower(left(Title,2))='wh' and PostTypeId=1 -- question ) wh_score, sum(Score)/count(*) score, (select sum(AnswerCount)

syntax error in Data Explorer

 ̄綄美尐妖づ 提交于 2019-12-13 07:14:41
问题 The Stack Exchange Data Explorer allows SQL queries against a Stack Exchange database. I tried this one — select month(CreationDate) month, year(CreationDate) year, sum(lower(left(Title,2))='wh')/count(*) wh, (select sum(Score)/count(*) from Posts u where month(CreationDate)=month(t.CreationDate) and year(CreationDate)=year(t.CreationDate) and lower(left(Title,2))='wh' and PostTypeId=1 -- question ) wh_score, sum(Score)/count(*) score, (select sum(AnswerCount)/count(*) from Posts u where

How to paginate Stack Exchange Data Explorer (SEDE) results?

北城余情 提交于 2019-12-11 02:48:03
问题 Using data explorer to create queries: SELECT P.id, creationdate,tags,owneruserid,answercount --SELECT DISTINCT TAGNAME ,TAGID FROM TAGS AS T JOIN POSTTAGS AS PT ON T.ID = PT.TAGID JOIN POSTS AS P ON PT.POSTID = P.ID --WHERE CAST(P.TAGS AS VARCHAR) IN('JAVA') WHERE PT.TAGID = 3143 How is it possible to add pagination in the query in order to take not only the first 50,000 results, but then run the query again to take the next remaining results? 回答1: There are a few ways to "page" through TSQL

Call Procedure for each Row without using a cursor and set the row with the result of the procedure

谁说胖子不能爱 提交于 2019-12-02 11:41:33
问题 I have this procedure : CREATE PROC dbo.##HTMLtoMARKDOWN @text nvarchar(500), @returnText nvarchar(500) output AS BEGIN DECLARE @counter tinyint SET @counter=1 WHILE CHARINDEX('**', @text, 1) > 0 BEGIN SELECT @text = STUFF(@text, CHARINDEX('**', @text, 1), 2, IIF(@counter%2=0,'<br><b>','</b>')), @counter = @counter + 1 END SET @returnText = @text END GO Which can be run like this: DECLARE @returnText nvarchar(500) EXEC dbo.##HTMLtoMARKDOWN '**a** **b** **c**', @returnText output I'm using

Call Procedure for each Row without using a cursor and set the row with the result of the procedure

和自甴很熟 提交于 2019-12-02 04:39:56
I have this procedure : CREATE PROC dbo.##HTMLtoMARKDOWN @text nvarchar(500), @returnText nvarchar(500) output AS BEGIN DECLARE @counter tinyint SET @counter=1 WHILE CHARINDEX('**', @text, 1) > 0 BEGIN SELECT @text = STUFF(@text, CHARINDEX('**', @text, 1), 2, IIF(@counter%2=0,'<br><b>','</b>')), @counter = @counter + 1 END SET @returnText = @text END GO Which can be run like this: DECLARE @returnText nvarchar(500) EXEC dbo.##HTMLtoMARKDOWN '**a** **b** **c**', @returnText output I'm using this kind of query: Select, IIF(IsUniversal=0,'TRUE','FALSE') as [Is Universal?], MarkdownMini as [Off