WITH lv_users AS ( SELECT DisplayName, Location, Id FROM ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Moderators

Q&A for community managers, administrators, and moderators

WITH
lv_users AS
(
SELECT DisplayName, Location, Id
FROM Users
WHERE LOWER(location) LIKE '%latvija%' OR LOWER(location) LIKE '%latvia%'
),
users_with_more_than_100_badges AS
(
SELECT
UserId,
Count(Badges.Name) as badge_count
FROM badges
GROUP BY Badges.UserId
HAVING Count(Badges.Name) > 100
),
users_with_more_than_100_badges_with_location_and_name as
(
SELECT * FROM
users_with_more_than_100_badges
JOIN lv_users
ON users_with_more_than_100_badges.UserId = lv_users.Id
)
SELECT * 
FROM Posts 
WHERE Posts.OwnerUserId IN 
(
SELECT UserId FROM users_with_more_than_100_badges_with_location_and_name
)
AND
CreationDate >= '2021-01-01'

Enter Parameters

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