[thelist] SQL query help
Anthony Baratta
Anthony at Baratta.com
Tue Jan 1 22:40:20 CST 2002
At 06:46 PM 1/1/2002, you wrote:
>I'm trying to think of a way to do this and it's not immediately coming to me:
Someone better at SQL will have a cleaner answer, but here's my 2K2 cents
worth:
I'd focus on using the Poll_ID to get the info.
Select Top 1 Polls.poll_question, poll_options.option_text,
Count(poll_answers.option_id)
from Poll_Answers
join poll_options on poll_options.poll_id = poll_answers.poll_answer_id
join Polls on Polls.poll_id = poll_answers.poll_answer_id
where poll_id = ????
Order By Count(poll_answers.option_id) Desc
---
Anthony Baratta
President
Keyboard Jockeys
"Conformity is the refuge of the unimaginative."
More information about the thelist
mailing list