I have this code :
$querystr = "
SELECT *
FROM {$wpdb->prefix}posts
INNER JOIN {$wpdb->prefix}postmeta m1
ON ( {$wpdb->prefix}posts.ID = m1.post_id )
INNER JOIN {$wpdb->prefix}postmeta m2
ON ( {$wpdb->prefix}posts.ID = m2.post_id )
WHERE
{$wpdb->prefix}posts.post_type = 'produits'
OR {$wpdb->prefix}posts.post_type = 'coupsdecoeur'
AND {$wpdb->prefix}posts.post_status = 'publish'
GROUP BY {$wpdb->prefix}posts.ID
ORDER BY {$wpdb->prefix}posts.post_date
DESC;
";
when loading page containing this so slooooooowwwww, is there a trick to optimize this ?
I just need the post title and a meta value called "wpcf-lien".
Thanks a lot.
WP_Query()
somehow not suiting your needs? Note that help with optimizing raw SQL is outside the scope of WPSE.