What I'm trying to do should look like this:

        <cfquery name="random_poll" datasource="#dsn#">
        SELECT DISTINCT TOP 1 portal_polls.poll_id, portal_polls.question, 
portal_polls.answer1, portal_polls.answer2, portal_polls.answer2, 
portal_polls.answer4, portal_polls.answer4, portal_polls.number_answers
        FROM   portal_polls, portal_groups_x_polls, portal_groups_x_students
        WHERE  (portal_polls.start_date < #Now()# and portal_polls.end_date > 
#Now()#)
                        and (everyone=1 OR 
(portal_groups_x_polls.poll_id=portal_polls.poll_id and 
portal_groups_x_students.group_id=portal_groups_x_polls.group_id and 
portal_groups_x_students.student_user_id=#session.userid#))
                        and not exists (SELECT * FROM 
portal_students_x_polls_completed WHERE 
portal_students_x_polls_completed.poll_id=portal_polls.poll_id and 
portal_students_x_polls_completed.student_user_id=#session.userid#)
        ORDER BY NEWID()
        </cfquery>

But when I do that it tells me: ORDER BY items must appear in the select list 
if SELECT DISTINCT is specified. I'm selecting distinct because of the 
likelihood that some records may be "weighted" if in multiple groups... and I 
don't want that to be a factor.

Ideas?

Thanks

Robert B. Harrison
Director of Interactive Services
Austin & Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be &.

Plug in to our blog: A&W Unplugged
http://www.austin-williams.com/unplugged


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346495
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to