I believe you’re looking for SQL UNION.
Related Posts:
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- How to correctly pass values to wpdb->prepare()?
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Pagination with custom SQL query
- Return only Count from a wp_query request?
- SQL query equivalent to WP User Query
- how to retrieve specific product attribute value in an sql query?
- Select from wp_post and multiple meta_value from wp_postmeta
- $wpdb select date range of posts
- List of the years with posts presented
- Optional Meta Query
- Custom Query num_rows returns wrong amount
- Editing the default wordpress search
- Iterating through $wpdb query without using get_results for large query results
- WP Query related posts by tags
- Order by summing multiple values
- Include data from custom table in WP_Query
- How to pass orderby params to $wpdb->prepare()?
- Is it possible to query from external database? [duplicate]
- Make a SQL query with wpdb in WordPress
- WordPress query posts with multiple post_meta data
- List of ways to access WordPress database?
- Query where ANDing slug values not working
- How to SQL query posts IDs by categories AND authors?
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- Passing a SQL query to the WP Query
- Doing $wpdb->get_results returns NULL, doing the same query in my DB returns correct value
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- What argument does my function need to echo get_results() query results
- Include post_status check within $wpdb query
- wpdb get_results() returns only 2 rows
- wpdb LIKE request shows all database data
- Convert a WP Query into a simpler SQL query to fetch only COUNT of posts
- How much does $wpdb->prepare(), then $wpdb->query() VS straight $wpdb->query(), can slow down the load time of whole page
- how to use transient method?
- WP_Query with “post_title LIKE ‘something%'”?
- Wp get all the sub pages of the parent using wp query
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- How to uniquely identify queries?
- Is it possible to select against a post’s parent’s fields with WP_Query?
- Multipart/formatted MySQL query problem
- Get posts by meta data OR title
- Use WP_Query with a custom SQL query
- Duplicate Queries
- SQL Statement generated by WP_Query not producing expected results
- What is an efficient way to query based on post_meta?
- How to count post type that has a particular term?
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- WP_Query Performance Issues with meta_query
- Should close $wpdb via $wpdb->close()
- Query Set Order By Author
- Retrieve or Query Pages by ID
- Advanced WP Query hogs the SQL server
- Get the Plugin Which Triggered a MySql Query in WordPress?
- Mysql query LIKE not working
- WP User Query get all authors with last name starting with specific letter
- How to orderby meta_value_num with dollar ($) sign
- Query: offset post list, unless it’s a specific category
- Complex WP SQL Query
- Sorting events by descending date, and ascending time if multiple events on a date
- Filtering posts from different categories into different section by doing WP_Query only once
- How to duplicate 5 posts out of WP_Query results?
- WP_Query with ‘rand’, but equal number of posts from the taxonomy terms given
- I can’t figure out what’s wrong with this statement. $wpdb->query update
- Sort WordPress Posts Meta value by Week not Day
- 2 wordpress loops showing 1 post from same post type – how to avoid showing the same post?
- How can I override one post and make it display content for another post?
- Ajax future single post query doesn’t work when NOT logged in
- Conditional sorting with variable using WP Query
- Why Query is returning empty array?
- Get multiple users with meta value in one query and populate WP_User class
- Custom Query – Based on user input
- meta_value timestamp older than now
- How to filter query loop block with a search string from the query parameters
- WP_Query: apply an SQL function to meta fileld value
- Why my query does not run with prepare
- How to avoid filling up an array each time I run a WP_query?
- WordPress SQL JOIN query
- Post incorrectly excluded when using “category__in”?
- Query multiple post types, but different order for each
- What is the equivalent WP_Query of a SQL Query?
- Query against multiple locations within single custom post type post
- How to get_comments() ordered by date and parent?
- How to make a search query if not found in post table then search in postmeta table?
- In which file to use $wpdb and its functions for database operations and queries in wordpress?
- Adding Category in WP_Query Not Working
- Merge two queries and remove duplicate
- how to show more than 1 post into three columns query
- Fetch only categorized posts
- Custom pagination (Title, date and teaser)
- Pagination in custom query in a category page
- Fire query on ajax post url page
- When should you use WP_Query vs query_posts() vs get_posts()?
- Wpdb generates too many queries
- Showing posts from 4 categories along with all latest posts
- Pagination in WP query with transient API
- A Depth Like Parameter For “get_posts”
- Advanced Search – Is this possible?
- How to make OR condition in WP_Query