Navigation überspringen

[Gelöst] MySQL question of new many-to-many relationship

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

How to setup SQL query to query many2many relationships that has an intermediary with fields.

Solution:

We don't provide the customize SQL query support, but you can still get the detail SQL query by these:

1) Create many-to-many relationship between two post types

2) Create a view to retrieve the related posts
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

OR Use Post relationship API to retrieve the related posts in your website
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post_types

3) Dashboard-> Toolset-> Settings-> Front-end Content
Enable option "Enable Views debug mode", and option "Full debug mode",
Run those page/post of step2), then you will be able to get those SQL query in details.

And you can also install other plugins to get the SQL query details, for example:
https://wordpress.org/plugins/search/query+monitor/

Relevant Documentation:

https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post_types

This support ticket is created vor 6 Jahren, 6 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von ScottM9386 vor 6 Jahren, 6 Monaten.

Assistiert von: Luo Yang.

Author
Artikel
#923729

Hello,

I've had no success in getting the view I need to work, so I think I'll need to use wpdata tables with a MySQL query.
Can anyone point me in the direction of how to query many2many relationships that has an intermediary with fields?
I'm in way over my head and will probably have to hire someone, but if you can give me some idea of how the relationships are stored.

Thanks,
Scott.

#923909

Hello,

We don't provide the customize SQL query support, but you can still get the detail SQL query by these:

1) Create many-to-many relationship between two post types

2) Create a view to retrieve the related posts
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

OR Use Post relationship API to retrieve the related posts in your website
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post_types

3) Dashboard-> Toolset-> Settings-> Front-end Content
Enable option "Enable Views debug mode", and option "Full debug mode",
Run those page/post of step2), then you will be able to get those SQL query in details.

And you can also install other plugins to get the SQL query details, for example:
https://wordpress.org/plugins/search/query+monitor/

#924944

thank you for the info!