Skip Navigation

[Resuelto] MySQL question of new many-to-many relationship

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

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 hace 6 años, 4 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Etiquetado: 

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por ScottM9386 hace 6 años, 4 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#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!