{"id":2763,"date":"2005-12-06T02:31:33","date_gmt":"2005-12-06T06:31:33","guid":{"rendered":"http:\/\/timesandseasons.org\/?p=2763"},"modified":"2005-12-06T11:06:21","modified_gmt":"2005-12-06T15:06:21","slug":"yet-another-tech-support-bleg","status":"publish","type":"post","link":"https:\/\/timesandseasons.org\/index.php\/2005\/12\/yet-another-tech-support-bleg\/","title":{"rendered":"Yet another tech support bleg"},"content":{"rendered":"<p><del datetime=\"2005-12-06T15:05:24+00:00\">An SQL problem of sorts has arisen, that is beyond our limited capabilities<\/del>.  Bryce to the rescue, once again.  I say we double his T&#038;S salary.<!--more--><\/p>\n<p>POST FORMERLY READ:<\/p>\n<p>We have a recent comments plugin.  It works.  (Horray!)<\/p>\n<p>It doesn&#8217;t have the capability of pulling comments by category type.  In fact, I&#8217;ve scoured the net, but no such plugin exists at the moment (despite some false advertising).  So I&#8217;m creating one, based on the other plugin.  So far so good.<\/p>\n<p>It&#8217;s a two step process, which should in theory be simple enough.  <\/p>\n<p>First, we collect all posts from category 62:<\/p>\n<blockquote><p>SQL query:<br \/>\nSELECT post_id FROM wp_post2cat WHERE category_id = &#8217;62&#8217;<\/p><\/blockquote>\n<p>(That query works, by the way).<\/p>\n<p>The next step will be to somehow merge that query into the existing plugin&#8217;s current query for pulling comments, which itself pulls data from two other tables.  I&#8217;d like to get that same data, <em>but only for posts that match the category check.<\/em>  <\/p>\n<p>The query on the plugin as it now stands &#8212; pulling comments without regard to category &#8212; is this:  <\/p>\n<blockquote><p>function get_bushman_comments () {<br \/>\n    global $wpdb, $tablecomments, $tableposts;<br \/>\n    $request = &#8220;SELECT ID, comment_ID, comment_content, comment_author, post_title, FROM $tablecomments LEFT JOIN $tableposts ON $tableposts.ID=$tablecomments.comment_post_ID WHERE post_status = &#8216;publish'&#8221;;<\/p><\/blockquote>\n<p>How can I add the prior query (pulling posts in category 62) to that, in order to limit the second query to getting data from those posts that come from the first query?  (Does that question make sense?)  Is there a good way to combine these two queries?  (Or some other obvious, easy solution that I&#8217;m missing?)  Glory, <a href=\"http:\/\/timesandseasons.org\/?p=2754\">fame<\/a>, <del datetime=\"2005-12-06T06:21:55+00:00\">and lucre<\/del> await the savvy bloggernacker who comes up with a working query.<\/p>\n<p>(Can&#8217;t Kaimi figure this out himself?  We&#8217;ll just say that one or two blog-rattling attempts later, Kaimi decided that playing with SQL on a loaded blog is not a good idea.  After all, we ain&#8217;t too proud to bleg; discretion is the better part of valor; he who fights and runs away; etc., etc.)<\/p>\n<p>Muchas gracias.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>An SQL problem of sorts has arisen, that is beyond our limited capabilities. Bryce to the rescue, once again. I say we double his T&#038;S salary.<\/p>\n","protected":false},"author":30,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2763","post","type-post","status-publish","format-standard","hentry","category-corn"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/posts\/2763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/comments?post=2763"}],"version-history":[{"count":0,"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/posts\/2763\/revisions"}],"wp:attachment":[{"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/media?parent=2763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/categories?post=2763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/timesandseasons.org\/index.php\/wp-json\/wp\/v2\/tags?post=2763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}