For my first table i have questions like this:
qid | question | date
1 blah 22-05-2009
and then i have the table comments
cid | qid
1 1
2 1
3 1
so then in my questions table i could have an added column which had total_comments which would be three
Ive tryed using this code
SELECT
questions.qid,
questions.question,
questions.date,
sum(comments.qid) AS total_money
FROM
questions
INNER JOIN comments ON comments.qid = questions.qid
ORDER BY questions.date
LIMIT 1
but it errors and only grabs the first row when there is a row with a greater date? Thanks in advance