morphboy23 Posted June 26, 2007 Share Posted June 26, 2007 Okay, so I've been trying for a while to figure this out, and haven't found a solution yet. The example is thus: there is a 'questions' table, with a column 'idquestion' (among others that don't matter right now). there is also an 'answers' table, which also has a 'idquestion' column which refers to the questions table one. multiple rows in 'answers' might refer to the same idquestion. I need to figure out a query that will select every questions.idquestion and the COUNT() of how many rows in 'answers' has that idquestion. So, for example, if 3 answers point to idquestion=1, 2 answers point to idquestion=2, and there are 0 rows that point to idquestions 3 through 10, I want: idquestion / COUNT() 1 / 3 2 / 2 3 / 0 ... / ... 10 / 0 Thanks for any help Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.