All User Tag Ranks by Location

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow Meta en español

Preguntas y respuestas sobre el sitio para programadores y profesionales de la informática

DECLARE @location varchar(255)
DECLARE @userId varchar(255)
SET @location = LOWER(CONCAT('%',rtrim(##CityName:string##),'%'))
SET @userId = rtrim(##UserId:string##)

--SELECT value
--FROM Users u
--JOIN Posts p ON p.OwnerUserId = u.Id
--INNER JOIN Posts q on q.id = p.parentid
--CROSS APPLY STRING_SPLIT(REPLACE(REPLACE(REPLACE(q.tags, '><', ','), '<', ''), '>', ''), ',')
--WHERE
    --LOWER(u.Location) LIKE @location
    --AND p.posttypeid = 2 -- just answers
    --AND value IN (
    SELECT value
      FROM Users u
      JOIN Posts p ON p.OwnerUserId = u.Id
      INNER JOIN Posts q on q.id = p.parentid
      CROSS APPLY STRING_SPLIT(REPLACE(REPLACE(REPLACE(q.tags, '><', ','), '<', ''), '>', ''), ',')
      WHERE
          LOWER(u.Location) LIKE @location
          AND p.posttypeid = 2 -- just answers
          AND p.OwnerUserId = @userId 
      GROUP BY value, p.OwnerUserId
--    ) 
--GROUP BY value, p.OwnerUserId

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results