Quiero exportar desde la base de datos la lista de publicaciones con categoría y etiqueta. Probé este SQL de WordPress: obtenga la categoría de publicación y las etiquetas, pero no funciona en mi MySQL 5.7.27 con errores
Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'wpdev.c.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Mi resultado esperado sería el mismo
+---------------+----------+----------------+
| post_id | category | tags |
|---------------+----------+----------------+
| 213 | news | tag1,tag2,tag3 |
+---------------+----------+----------------+
Mi declaración es:
SELECT p.id, p.post_name, c.name, GROUP_CONCAT(t.name)
FROM wp_posts p JOIN wp_term_relationships cr on (p.id=cr.object_id)
JOIN wp_term_taxonomy ct on (ct.term_taxonomy_id=cr.term_taxonomy_id and ct.taxonomy='category')
JOIN wp_terms c on (ct.term_id=c.term_id)
JOIN wp_term_relationships tr on (p.id=tr.object_id)
JOIN wp_term_taxonomy tt on (tt.term_taxonomy_id=tr.term_taxonomy_id and tt.taxonomy='post_tag')
JOIN wp_terms t on (tt.term_id=t.term_id)
GROUP BY p.id
Gracias de antemano.
.