need some MySQL help

T

TheJkWhoSaysNi

Guest
i have an SQL query with an AS in:

Code:
SELECT *, COUNT(Voter) AS numVotes FROM MOTM WHERE Month = '$month' AND Year = '$year' $poll GROUP BY Votee ORDER BY numVotes DESC

What i want to do then, is query on the results i got back from that using the numVotes column... it must be possible, but how?


Thanks.
 
D

Deathwatch

Guest
You get the number of votes then, and you want to do another select query on that list you got? If so, I guess you could do:

SELECT *
FROM (SELECT *, COUNT(Voter) ... DESC) AS Votes
WHERE numVotes > 5

or something :)

(my sql is (very) rusty so I might be wrong)
 
T

TheJkWhoSaysNi

Guest
i think i need a seperate query, i tried

SELECT * FROM $sql1

But that diddnt work :-\
 
D

Deathwatch

Guest
Ofcourse you can't access numVotes directly, its Votes.numVotes as you might have to specify the table its from

(still, I'm not certain about this)
 
T

TheJkWhoSaysNi

Guest
nevermind i figured out a way around it by using a 2nd query and a loop. and sorry i posted it in the wrong forum, i diddnt know this webdev one existed :rolleyes:
 

Users who are viewing this thread

Similar threads

S
Replies
6
Views
706
wyrd_fish
W
P
Replies
13
Views
1K
wyrd_fish
W
W
Replies
4
Views
868
evilmonkeh
E
L
Replies
4
Views
594
wyrd_fish
W
T
Replies
6
Views
763
(Shovel)
S
Top Bottom