SELECT u.Id AS [User Link], CONCAT('https://stackoverflow...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

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,
                            questions.QuestionsPosted,
                            answers.AnswersPosted
             FROM Users u
         
             JOIN (
                    SELECT DISTINCT UserId
                    FROM Badges
                    WHERE LOWER(Name) IN ('yearling') AND
                          Class IN (2) AND
                          TagBased = 0
                  ) user_badges
             ON user_badges.UserId = u.Id
              
             LEFT JOIN
             (
               SELECT OwnerUserId, COUNT(*) AS QuestionsPosted
               FROM Posts
               JOIN PostTypes
               ON PostTypes.Id = Posts.PostTypeId
               WHERE PostTypes.Name = 'Question'
               GROUP BY Posts.OwnerUserId
             ) questions
             ON questions.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 '%sweden%'

Enter Parameters

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