• hi,

    my SQL below gets the last 8 blog posts, I would also like to get the post image too but am unsure of where to find the URL of teh image based on the blog post?!

    SELECT
    	blog_posts.post_title,
    	blog_posts.post_name,
    	blog_posts.post_date,
    	blog_posts.guid,
    	blog_users.display_name
    
    	FROM
    	blog.blog_posts,
    	blog_users,
    	blog_term_relationships,
    	blog_term_taxonomy,
    	blog_terms
    
    	WHERE
    		blog_posts.post_status = 'publish'
    	AND blog_posts.post_type = 'post'
    	AND blog_posts.ID = blog_term_relationships.object_id
    	AND blog_term_relationships.term_taxonomy_id = blog_term_taxonomy.term_taxonomy_id
    	AND blog_term_taxonomy.taxonomy = 'post_tag'
    	AND blog_term_taxonomy.term_id = blog_terms.term_id
    	AND (blog_terms.slug LIKE '%fluk%' OR blog_terms.slug LIKE '%english%' OR blog_terms.slug LIKE '%spanish%' OR blog_terms.slug LIKE '%french%' OR blog_terms.slug LIKE '%german%' OR blog_terms.slug LIKE '%italian%' OR blog_terms.slug LIKE '%language%' OR blog_terms.slug LIKE '%evening%' OR blog_terms.slug LIKE '%intensive%' OR blog_terms.slug LIKE '%saturday%' OR blog_terms.slug LIKE '%london%' OR blog_terms.slug LIKE '%brighton%' OR blog_terms.slug LIKE '%bristol%' OR blog_terms.slug LIKE '%leeds%' OR blog_terms.slug LIKE '%liverpool%' OR blog_terms.slug LIKE '%manchester%' OR blog_terms.slug LIKE '%oxford%' OR blog_terms.slug LIKE '%sheffield%' OR blog_terms.slug LIKE '%uk %' OR blog_terms.slug LIKE '%weekend%' OR blog_terms.slug LIKE '%portuguese%')
    	AND blog_posts.post_author = blog_users.ID
    	GROUP BY blog_posts.ID
    	ORDER BY blog_posts.post_date DESC
    	LIMIT 8
  • The topic ‘SELECT post image url FROM blog posts?’ is closed to new replies.