Query multiple tables with joins
-
Folks,
I want to create a widget that will return posts sorted by category, by rating, and by number of page views. The ratings and page view counts are in different tables in the WP database.
The posts are obviously in wp_posts. The rating is in a table (call it wp_rating)that contains a field holding the average reader rating. The post views are in yet another table that I’ll call wp_views.
Can someone point me to the most efficient way to:
SELECT posts in the last seven days
WHERE post_views > 1
ORDER BY (Rating * Post_Views) DESCso I can create an internal loop that will let me put the top 5 or six in a box with a link to a page that will display them all?
TIA
Ed
- The topic ‘Query multiple tables with joins’ is closed to new replies.