Hi,
I am trying to make a query to get the post title, link and images of the post. I have what I need with the following query:
SELECT WPPOSTS.post_title,WPPOSTS.guid,WPPOSTS_2.image
FROM wp_posts WPPOSTS
LEFT JOIN
(
SELECT guid AS image,post_parent
FROM wp_posts
WHERE post_type = 'attachment'
ORDER BY post_date_gmt DESC
) WPPOSTS_2 ON (WPPOSTS_2.post_parent = WPPOSTS.ID)
WHERE WPPOSTS.ID IN (2439,2395,2355)
Now, what I really want is to get only the last thumbnail inserted in the post, not all of them. That's the reason why I have already considered the order by clause. I have tried putting a "LIMIT 1" inside the LEFT JOIN SELECT but I guess that's wrong.
Any idea? Thanks