I have this SQL query here:
however I would like to get the count total from this how can I do it?PHP Code:SELECT wp_posts.*, wp_postmeta.* FROM wp_posts, wp_postmeta WHERE wp_posts.ID=wp_postmeta.post_id AND meta_key='image_path' group by ID desc
| SitePoint Sponsor |
I have this SQL query here:
however I would like to get the count total from this how can I do it?PHP Code:SELECT wp_posts.*, wp_postmeta.* FROM wp_posts, wp_postmeta WHERE wp_posts.ID=wp_postmeta.post_id AND meta_key='image_path' group by ID desc


what exactly is it that you want to count?
what table does the ID in your GROUP BY clause belong to?


do you want the count for each ID, or the total count overall?


Code:SELECT post_id , COUNT(*) FROM wp_postmeta WHERE meta_key = 'image_path' GROUP BY post_id DESC


Bookmarks