I have 3 tables.... posts postid | author | poststatus 20 | mark | published 21 | lisa | published 22 | glen | published 23 | ace | published 24 | ace | draft 25 | mark | published 26 | mark | published 27 | lisa | published 28 | glen | published 29 | mark | published relations postid | category 20 | science 21 | math 22 | math 23 | english 24 | english 25 | science 26 | math 27 | english 28 | english 29 | math category category | categorystatus science | show math | show english | notshow im really having problems with joning 3 tables... In my query, i want to list(group) all authors and count all their posts that are in a category in which the category status is "show" this is what i've done so far.... (2 tables joined) SELECT posts.author, count(*) FROM posts INNER JOIN relations ON posts.postid = relations.postid WHERE (posts.poststatus = 'published') AND (posts.author = 'mark ' OR posts.author = 'lisa' OR posts.author = 'glen' OR posts.author = 'ace') GROUP BY posts.author it counts all posts from all the authors. but still lacks the ability to join the 3rd table in which it can determine if a post is from a category that the status is "show" TIA
I just tested it... on localhost: This query will count posts for each author if the categorystatus has value 'show' and poststatus has value 'published'