Libre

msg:4223108 | 1:58 am on Oct 28, 2010 (gmt 0) |
With this query... SELECT `profile_rate`.`Profile` , COUNT( * ) AS Count FROM `profile_rate` WHERE `profile_rate`.`Member` = 'Ana' GROUP BY `profile_rate`.`Profile` I get this result... Profile | Count ---------------- Jim | 1 Bob | 1 Joe | 1 But I dont know how to join the other usernames to the Profile field
|
enigma1

msg:4223294 | 10:23 am on Oct 28, 2010 (gmt 0) |
If you want to get the profiles who were voted for Yes then: select profile, count(rate) as total from profile_rate where rate='Yes' group by profile If you wanted to get the profiles who were just voted, remove the where clause, and if you want to check for a specific name add in the where clause the name of the member. Would be easier if you had a tinyint instead of the Yes/No rate because you could use the mysql sum to add up all the votes. Right now to get the No's you will have to use the same table as an alias and count them.
|
Libre

msg:4223446 | 4:29 pm on Oct 28, 2010 (gmt 0) |
The problem it that I want to get the profiles where Ana did not vote for. On this moment I get first the rows where Ana has voted for, save it in a hash, for to check it later with a other query for a row where Ana did not voted for.
|
enigma1

msg:4223569 | 8:17 pm on Oct 28, 2010 (gmt 0) |
I don't see the point however. The members who aren't voting for Ana can be retrieved as a total if you want to calculate percentages. select count(member) as total from profile_rate And then you have the total number of members and from the other query you have the members who voted for Ana. It's faster in to perform the 2 different queries than joining tables and getting the total from all the rows.
|
|