Welcome to WebmasterWorld Guest from 184.108.40.206
Forum Moderators: open
SELECT DISTINCT(blog_galleries.post_id), COUNT(blog_galleries.post_id) AS howmany
FROM blog_galleries, blog_posts, blog_blogs
WHERE blog_posts.id=blog_galleries.post_id AND blog_posts.published='1' AND blog_posts.blog=blog_blogs.id AND blog_posts.date BETWEEN (NOW() - INTERVAL 1 YEAR) AND (NOW())
GROUP BY blog_galleries.post_id HAVING howmany>2
I have 3 tables (blog_galleries, blog_posts, and blog_blogs). I need to select all galleries which have more than 2 photos, which are associated to posts published within the last year.
blog_blogs (id, ...)
blog_posts (id, blog, published, date)
blog_galleries (id, post_id...)
Thaaaaaanks a lot.