The wordpress database seems fairly straight forward and is extremely well documented:
http://codex.wordpress.org/Database_Description
It seems to me that all the category information is stored in the table wp_term_relationships. So you should select from the comments table, join it with the posts table and then the term_relationships table in order to get the category for each comment.
Something like:
SELECT *
FROM wp_comments
WHERE comment_post_ID
IN (
SELECT c.object_id
FROM wp_terms a, wp_term_taxonomy b, wp_term_relationships c
WHERE a.name="my_category_slug"
AND b.term_id = a.term_id
AND b.taxonomy = 'category'
AND c.term_taxonomy_id = b.term_taxonomy_id
)
Related Posts:
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- Case in Select Statement
- What is SELF JOIN and when would you use it? [duplicate]
- Self Join to get employee manager name
- How do I UPDATE from a SELECT in SQL Server?
- MySQL “CREATE TABLE IF NOT EXISTS” -> Error 1050
- Online SQL Query Syntax Checker
- How can I do an UPDATE statement with JOIN in SQL Server?
- How do I use properly CASE..WHEN in MySQL
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- SQL SELECT WHERE field contains words
- Case statement in MySQL
- How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
- Drop a temporary table if it exists
- ORA-00918: column ambiguously defined in SELECT *
- IDENTITY_INSERT is set to OFF – How to turn it ON?
- How to reset AUTO_INCREMENT in MySQL
- How do I limit the number of rows returned by an Oracle query after ordering?
- MySQL: Invalid use of group function
- Why does NULL = NULL evaluate to false in SQL server
- Compare dates in MySQL
- Best way to do nested case statement logic in SQL Server
- Difference between one-to-many and many-to-one relationship
- Get day of week in SQL Server 2005/2008
- incorrect syntax error CREATE VIEW must be the only statement in the batch
- PLS-00103: Encountered the symbol when expecting one of the following:
- ORA-00918: column ambiguously defined in SELECT *
- How do I format date and time on ssrs report?
- MySQL Error 1264: out of range value for column
- How to parse XML data in SQL server table
- How do you create a temporary table in an Oracle database?
- Oracle SQL: Update a table with data from another table
- How to SUM and SUBTRACT using SQL?
- Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL?
- Determine ROW that caused “unexpected end of file” error in BULK INSERT?
- Postgresql tables exists, but getting “relation does not exist” when querying
- Sql query to insert datetime in SQL Server
- Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 4 (Year)
- SQL selecting rows by most recent date with two unique columns
- Postgres Error: More than one row returned by a subquery used as an expression
- Comparing Dates in Oracle SQL
- How to divide two columns?
- SQL Parentheses use in an OR clause
- Is it possible to GROUP BY multiple columns using MySQL?
- What is the difference between LATERAL JOIN and a subquery in PostgreSQL?
- SQL “select where not in subquery” returns no results
- ListAGG in SQLSERVER
- Is there a Max function in SQL Server that takes two values like Math.Max in .NET?
- Best way to test if a row exists in a MySQL table
- The used SELECT statements have a different number of columns
- Get current year in TSQL
- Is it possible to specify condition in Count()?
- SQL Server: Make all UPPER case to Proper Case/Title Case
- using sql count in a case statement
- How do I query for all dates greater than a certain date in SQL Server?
- Temporary table in SQL server causing ‘ There is already an object named’ error
- Oracle: If Table Exists
- Equivalent of explode() to work with strings in MySQL
- How to calculate age (in years) based on Date of Birth and getDate()
- How to create id with AUTO_INCREMENT on Oracle?
- MySQL OPTIMIZE all tables?
- MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET
- Text was truncated or one or more characters had no match in the target code page including the primary key in an unpivot
- How can I group by date time column without taking time into consideration
- How do I count unique items in field in Access query?
- Sqlite: CURRENT_TIMESTAMP is in GMT, not the timezone of the machine
- Update query using Subquery in Sql Server
- What is a postgres superuser
- “This SqlTransaction has completed; it is no longer usable.”… configuration error?
- register_post_status – show_in_admin_all_list & show_in_admin_status_list does not affect query
- prepare() not working
- How do I move a WordPress site to another server?
- Return number of items in a table with post id
- WP Optimization: Removing Orphaned wp_options (especially the autoload ones)
- Auto-update tables from database
- Debugging WordPress
- dbDelta not creating table (yes, once more)
- Pull data and display as rows and columns
- I need a SQL command to delete specific authors and all posts connected with them
- How can i restore only Blogs from a SQL backup file?
- DB_HOST – is LOCALHOST speedy than domain name? [closed]
- Can Anyone provide an example of RAW SQL for SELECTING posts by 2 or more tags
- REGEXP_REPLACE in post_contet
- How to change post published date to today date with SQL
- Menu Order updating automatically
- Do I need to sanitize $_POST[‘keyword’] before send to ‘s’ parameter?
- How delete post_content records of specific category from phpmyadmin
- how to SELECT meta values that are not null?
- Fastest way to display 5000 post titles?
- How do I display SQL query on a specific page of my wordpress site
- Is it possible to utilize custom SQL for a single-post.php?
- How to handle my row actions on a custom list table in the admin section
- blank page after update my theme
- Sql query returns empty. But not
- How can I avoid duplicate primary keys in SQL import?
- SQL – JOIN last child
- Get comments after specific date
- Adding profile data to database
- This SQL request call all time and overload my server : SELECT meta_value FROM wp_sitemeta WHERE meta_key = ‘wp_installer_network’ AND site_id = 1