NearMe

0

Please login or register to vote for this query.

(click on this box to dismiss)

Home Improvement

Q&A for contractors and serious DIYers

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),
Age int,
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('%' + ##Tag:string## + '%') AND b.TagBased = 1 AND b.Class = 1


INSERT INTO @myUsers (Id, Reputation, CreationDate, DisplayName, LastAccessDate, WebsiteUrl, Location, AboutMe, 
Views, UpVotes, DownVotes, ProfileImageUrl, EmailHash, Age, AccountId)
SELECT Id, Reputation, CreationDate, DisplayName, LastAccessDate, WebsiteUrl, Location, AboutMe, 
Views, UpVotes, DownVotes, ProfileImageUrl, EmailHash, Age, AccountId
FROM Users u
WHERE u.Id IN (SELECT UserId FROM @myBadges)

SELECT * FROM @myUsers where upper(location) like upper('%' + ##YourLocation:string## + '%') -- uppercase location--

Enter Parameters

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