BE

0

Please login or register to vote for this query.

(click on this box to dismiss)

Anime and Manga

Q&A for anime and manga fans

SELECT u.Id AS [User Link],
                            CONCAT('https://stackoverflow.com/users/', u.Id) AS [Profile Link],
                            u.DisplayName,
                            u.Location,
                            u.WebsiteUrl,
                            u.AboutMe,
                            u.Views,
                            u.UpVotes,
                            u.DownVotes,
                            bounties.BountiesWon,
                            answers.AnswersPosted
             FROM Users u
        
             JOIN (
                    SELECT DISTINCT UserId
                    FROM Badges
                    WHERE LOWER(Name) IN ('python') AND
                          Class IN (1, 2, 3) AND
                          TagBased = 1
                  ) tag_badges
             ON tag_badges.UserId = u.Id
             
             LEFT JOIN 
             (
               SELECT Posts.OwnerUserId, COUNT(*) As BountiesWon
               FROM Votes
               JOIN Posts ON Votes.PostId = Posts.Id
               JOIN VoteTypes ON VoteTypes.Id = Votes.VoteTypeId
               WHERE VoteTypes.Name = 'BountyClose'
               GROUP BY Posts.OwnerUserId
             ) bounties
             ON bounties.OwnerUserId = u.Id
             
             LEFT JOIN
             (
               SELECT OwnerUserId, COUNT(*) AS AnswersPosted
               FROM Posts
               JOIN PostTypes
               ON PostTypes.Id = Posts.PostTypeId
               WHERE PostTypes.Name = 'Answer'
               GROUP BY Posts.OwnerUserId
             ) answers
             ON answers.OwnerUserId = u.Id
             
             WHERE LOWER(Location) LIKE '%mumbai%' OR
                            LOWER(Location) LIKE '%visakhapatnam%' OR
                            LOWER(Location) LIKE '%coimbatore%' OR
                            LOWER(Location) LIKE '%delhi%' OR
                            LOWER(Location) LIKE '%bangalore%' OR
                            LOWER(Location) LIKE '%pune%' OR
                            LOWER(Location) LIKE '%indore%' OR
                            LOWER(Location) LIKE '%vadodara%' OR
                            LOWER(Location) LIKE '%nagpur%' OR
                            LOWER(Location) LIKE '%kolkata%' OR
                            LOWER(Location) LIKE '%bhopal%' OR
                            LOWER(Location) LIKE '%kanpur%' OR
                            LOWER(Location) LIKE '%new delhi%' OR
                            LOWER(Location) LIKE '%chennai%' OR
                            LOWER(Location) LIKE '%jaipur%' OR
                            LOWER(Location) LIKE '%hyderabad%' OR
                            LOWER(Location) LIKE '%ahmedabad%'

Enter Parameters

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