Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [join-tables]

The tag has no usage guidance.

0
votes
0answers
26 views

How can I JOIN two wp_posts?

I have a problem with table JOIN SQL (CPT/Pods). For many hours I tried, but no result. Ex. studio (post_title, city, date, song->) song (post_title, date, band->) - SELECT wp_posts.ID AS ...
0
votes
1answer
55 views

Build table using Advanced Custom Fields

I have a table that populates data pulled from ACF. It basically adds a PDF of a report if there's one available. I think I got that part figured out, but my code is awfully complicated and I'll like ...
1
vote
0answers
25 views

What Is the Proper Way to Merge Usermeta Table to a an existing WP Database?

I'm currently testing some features on a sandbox environment. I have an existing production website and I'd like to ship my production users and other related tables on new sandbox environment. While ...
2
votes
1answer
214 views

Custom Queries: Joining On Meta Values From Two Custom Post Types

Hi – I'm hoping this is the right place to be asking this question. I am in the process of moving my full football club website onto Wordpress, therefore using a single database for the information ...
-1
votes
1answer
20 views

How do I insert the following into my custom table?

$service = array( 'show_option_all' => 'Select your Service', 'show_option_none' => '', 'option_none_value' => '-1', 'orderby' => 'name', 'order' => 'ASC', ...
0
votes
0answers
121 views

Custom user query - orderby meta_key (that may not exist)

I'm in need of someone who knows MySQL better than I do! I've started writing a custom statement, but I'm not an expert with mySQL and it's not quite there (I'm happy to scrap it entirely if there's a ...
0
votes
1answer
1k views

What does the $posts_join filter join to?

I am trying to use the posts_join filter to join 2 tables: wp_postmeta to wp_posts. I am a novice at SQL, so I'm not sure if I am confused because I don't understand how WordPress is implementing ...
1
vote
1answer
6k views

writing inner join in wpdb

I have a problem in writing SQL Inner Join syntax in wordpress, This logic should definitely work, I tried this in phpmyadmin and it works fine SELECT booking_calendars.cal_name FROM ...
1
vote
2answers
1k views

Query All users that has post

I have this query so far : $user_args = array( 'role' => 'frontend_vendor', 'orderby' => 'display_name', 'order' => 'ASC', ...
0
votes
1answer
1k views

Inner Join user tables to select users with roles

I am trying to view a list of users (who are music artists) with the following function. function show_authors($ltr) { global $wpdb; $querystr = "SELECT $wpdb->users.* FROM $wpdb->...
0
votes
0answers
61 views

WP_Query to show post from a category OR custom field - Not 100% answered

Regarding answer provided by birgirethis to this post: wp-query-to-show-post-from-a-category-or-custom-field I found one issue with your solution. The two inner joins (term_relationships and postmeta)...
1
vote
0answers
97 views

Using $wpdb to fetch posts with meta data

I have a post type "shows" with 500 posts in it. I want to list all 400 in one page listing their title + 5 meta fields and a url to the show post thumbnail. I initially went the classic wordpress ...
1
vote
1answer
2k views

How to use filter hook posts_join for querying taxonomy terms in posts_where?

For the last few hours, I have been trying to use the filter hooks posts_where and posts_join to search for posts based on taxonomy terms, in this case, the taxonomy is 'category' and the term is '...
2
votes
1answer
3k views

How to search for posts IN OR title OR content OR author?

I have looked at many posts and questions regarding searches for custom meta, but I want to search for posts and include those if the search query matches an author name. I have come up with the ...
0
votes
1answer
733 views

WP_Query hit max joins… How else can I build a search function that uses custom fields?

I'm trying to search a custom post type of "Properties", while doing so I'm also searching the custom fields using multiple (anywhere from 5-30) meta_queries. The problem is Wordpress or MySQL is ...
0
votes
1answer
682 views

Are term_taxonomy_id and term_id the same? [duplicate]

I have a custom query where I need a JOIN because I want to COUNT all the posts of a specific category. So I checked the tables and I found out that table wp_term_relationships contains a reference ...
0
votes
1answer
563 views

$wpdb - joining shows no result

For one of my client's WP site, I'm making a plugin, where I'm using the db Query. I've two custom tables dedicated to the plugin: user_req — stores user chosen posts along with some custom ...
0
votes
2answers
3k views

How to join tables?

I know many posts is on the site about this but I can't understand how it work. This SQL works. SELECT wp_category.id, wp_ogloszenia_kupione.kategoria, klient_id FROM wp_category JOIN ...
0
votes
1answer
64 views

Reordering content using a meta value

I've got this theme where you can add posts of type "portfolio", and I want to be able to reorder them up. I've added a custom meta field called "position" and I've set already those values. All good. ...
0
votes
2answers
4k views

Wordpress SQL JOIN query

Hi Im trying to run 2 querys in the same query call. // send the query global $wpdb; $commentQ = "SELECT * FROM $wpdb->comments " . $whereClause . $orderBy; $comments = $wpdb->...
1
vote
2answers
2k views

Join new table with SQL query

I created a plugin with a new table (wp_soundcloud) and I need to retrieve the data from that new table along with the post data. Here is my query: $querystr = " SELECT $wpdb->posts.*, ...
0
votes
1answer
987 views

List author's posts with SQL

I want display authors'posts with the code below but authors' name aren't showing. What is wrong? <? // query test $qry = $wpdb->get_results( $wpdb->prepare(" SELECT * FROM $wpdb->posts ...
-1
votes
1answer
120 views

Custom wordpress SQL statement for a website

I'm trying to link specific columns from a few standard tables in a wordpress database. I specifically want to see a view/table that includes: post title post content guid meta value = image url ...
0
votes
2answers
288 views

Joining tables not working in the post editor page

I am developing a plug-in which stores data in a custom table and is joined onto the wp_posts by the post's the id. I then use the posts_join and post_fields filters to join my table and be able ...
1
vote
1answer
7k views

Join inside a wpdb query.. confused!

I need to get a return from a query that provides me with email, username or nicename as well as post title based on author id. The query is to run once daily via cron and look for posts that have ...