Answer the question
In order to leave comments, you need to log in
Is it possible to combine these 2 sql queries?
Good afternoon
Tell me please, is it possible to combine these two requests into 1?
First, gets the id of all records of the term I need
IDS_ARRAY =
SELECT id FROM wp_posts
LEFT JOIN wp_term_relationships ON
(wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_term_taxonomy ON
(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)
WHERE wp_posts.post_type = 'water'
AND wp_term_taxonomy.taxonomy = 'menu'
AND wp_term_taxonomy.term_id = 22
ORDER BY post_date DESC
SELECT * FROM wp_postmeta WHERE post_id in (IDS_ARRAY) AND meta_value LIKE "field\_%" AND meta_key LIKE "%sku%"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question