WITH predvyber AS ( SELECT Users.Id, Users.DisplayName, P...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

WITH predvyber AS (
  SELECT
--    TOP(10)
    Users.Id,
    Users.DisplayName,
    Posts.Title,
    Posts.CreationDate,
    Posts.ViewCount
  FROM
    Posts
  JOIN
    Users ON Posts.OwnerUserId = Users.Id
  WHERE
    Posts.PostTypeId = 1
    AND Posts.CreationDate > '2023-11-01'
    AND Posts.ViewCount > 1
    AND (Users.Id = 4710409 OR Users.Id = 476371)
--  ORDER BY
--    Users.Id,
--    Posts.ViewCount DESC
--  OFFSET 0 ROWS
)

SELECT
  predvyber.*
FROM
  predvyber
WHERE
  (SELECT
     COUNT(*)
   FROM
     predvyber AS pocitadlo
   WHERE
     pocitadlo.Id = predvyber.Id
  ) < 4
ORDER BY
  predvyber.Id,
  predvyber.ViewCount DESC;

Enter Parameters

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