[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    how to select total votes for each comment?
From:       "Patrick Aljord" <patcito () gmail ! com>
Date:       2008-03-05 3:05:38
Message-ID: 6b6419750803041905h1c989e13keb2bb41b6ad9d68d () mail ! gmail ! com
[Download RAW message or body]

Hey all,
I have comments(id,content) and votes(comment_id,vote). vote is a tinyint.

I would like to select total votes for each comment, I tried:

 "select content, sum(v.votes) from comments c left join votes v on
c.id=v.comment_id"

but it only returns first result obviously, any idea how I could do this?

Thanks in advance,

Pat

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic