Title: Database Query Multiple Tables
Last modified: August 20, 2016

---

# Database Query Multiple Tables

 *  [Ed N.](https://wordpress.org/support/users/enailor/)
 * (@enailor)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/database-query-multiple-tables/)
 * I am lost, and the more I read, the more lost I seem to be… normally, I get this,
   but for some reason it is as clear as mud to me right now.
 * I need to be able to query the database, pulling data that matches only certain
   criteria. I am using the Media Category plugin which is assigning a CPT to the
   media. So I need to pull only attachments under a specific media category.
 * So, my query must pull post_type = ‘attachment’ so long as the custom post type
   term matches. Don’t care if I compare with term ID, name, ect.
 * From what I am seeing, it looks like I need a JOIN query, but I am not getting
   the markup at all, and I have been playing with this for hours. I need help!
 * Anyone?

The topic ‘Database Query Multiple Tables’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [join](https://wordpress.org/support/topic-tag/join/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Ed N.](https://wordpress.org/support/users/enailor/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/database-query-multiple-tables/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
