Users With Gold Badges Related to a Given Tag in UK

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

DECLARE @myUsers TABLE
(
Id int,
Reputation int,
CreationDate datetime,
DisplayName nvarchar(40), 
LastAccessDate datetime, 
WebsiteUrl nvarchar(200),
Location nvarchar(100), 
AboutMe nvarchar(max), 
Views int,
UpVotes int,
DownVotes int,
ProfileImageUrl nvarchar (200),
EmailHash varchar (32),
AccountId int
)

DECLARE @myBadges TABLE
(
Id int,
UserId int,
Name nvarchar (50),
Date datetime,
Class tinyint,
TagBased bit
)

INSERT INTO @myBadges (Id, UserId, Name, Date, Class, TagBased)
SELECT Id, UserId, Name, Date, Class, TagBased
FROM Badges b
WHERE UPPER(b.name) LIKE UPPER('%java%') AND b.TagBased = 1 AND b.Class = 1


INSERT INTO @myUsers (Id, Reputation, CreationDate, DisplayName, LastAccessDate, WebsiteUrl, Location, AboutMe, 
Views, UpVotes, DownVotes, ProfileImageUrl, EmailHash, AccountId)
SELECT Id, Reputation, CreationDate, DisplayName, LastAccessDate, WebsiteUrl, Location, AboutMe, 
Views, UpVotes, DownVotes, ProfileImageUrl, EmailHash, AccountId
FROM Users u
WHERE u.Id IN (SELECT UserId FROM @myBadges)
and (lower(location) like '%uk%' OR lower(location) like '%london%')


SELECT * FROM @myUsers

Enter Parameters

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