{"id":87252,"date":"2024-06-22T18:28:00","date_gmt":"2024-06-22T22:28:00","guid":{"rendered":"https:\/\/bugaluu.com\/sapiosexual\/how-to-avoid-repeating-a-subquery-in-a-query-r-sql-reddit\/"},"modified":"2025-09-10T18:34:43","modified_gmt":"2025-09-10T22:34:43","slug":"how-to-avoid-repeating-a-subquery-in-a-query-r-sql-reddit","status":"publish","type":"post","link":"https:\/\/bugaluu.com\/sapiosexual\/how-to-avoid-repeating-a-subquery-in-a-query-r-sql-reddit\/","title":{"rendered":"How to avoid repeating a subquery in a query? : r\/SQL &#8211; Reddit"},"content":{"rendered":"<p>It should be called something like &#8220;Questions answered by more than 3 Top Users&#8221; (maybe the original query hard-coded 50k). It has the Q.AnswerCount = 3 in its WHERE filter, which would presumably be the total number of answers, rather than just the answers by top users. To me, this kind of problem really seems to need a GROUP BY \/ HAVING.<\/p>\n<p><a href=\"https:\/\/www.reddit.com\/r\/SQL\/comments\/hag5q7\/how_to_avoid_repeating_a_subquery_in_a_query\/\" target=\"_blank\" class=\"\">https:\/\/www.reddit.com\/r\/SQL\/comments\/hag5q7\/how_to_avoid_repeating_a_subquery_in_a_query\/<\/a>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It should be called something like &#8220;Questions answered by more than 3 Top Users&#8221; (maybe the original query hard-coded 50k). It has the Q.AnswerCount =&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-87252","post","type-post","status-publish","format-standard","hentry","category-web","wpcat-3-id"],"_links":{"self":[{"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/posts\/87252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/comments?post=87252"}],"version-history":[{"count":0,"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/posts\/87252\/revisions"}],"wp:attachment":[{"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/media?parent=87252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/categories?post=87252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bugaluu.com\/sapiosexual\/wp-json\/wp\/v2\/tags?post=87252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}