If I do the query:
SELECT wp_p2p.p2p_to, post_date from wp_p2p inner join wp_posts on wp_p2p.p2p_from = wp_posts.ID group by p2p_to order by min(wp_posts.post_date)
I get two columns wp_p2p.p2p_to and wp_posts.post_date
I need an update statement for wp_posts that does this:
UPDATE wp_posts set wp_posts.post_date = (post_date column from above) where wp_posts.ID = (the p2p_to column from above)
Francisco Javier Carazo Gil answers:
Maybe a PHP loop is a better solution for this case.
Include subselects in a UPDATE sentence is not a good idea.
Francisco Javier Carazo Gil comments:
1) Create an array with wp_p2p.p2p_to as key and wp_posts.post_date as value
2) Do an loop, doing a update in SQL of every register in the array
If have any doubt tell me.