#x27;t be either/or. It must be &.
Plug in to our blog: A&W Unplugged
http://www.austin-williams.com/unplugged
-Original Message-
From: Maureen [mailto:mamamaur...@gmail.com]
Sent: Thursday, August 04, 2011 1:38 PM
To: cf-talk
Subject: Re: COMPLEX SQL RANDOM: SOLVED
Is there
Is there a reason you are selecting portal_polls.answer2 and
portal_polls.answer4 twice, or is that a typo?
On Thu, Aug 4, 2011 at 6:13 AM, Robert Harrison
wrote:
>
> Thanks for all of your answers. I tried a few of the suggestions but they
> weren't quite right.
>
> Bill Franklin's answer, whi
: Jochem van Dieten [mailto:joch...@gmail.com]
Sent: Wednesday, August 03, 2011 3:08 PM
To: cf-talk
Subject: Re: COMPLEX SQL RANDOM
On Wed, Aug 3, 2011 at 9:36 PM, Bill Franklin wrote:
> Why not try something like this...(not sure which database you are using)
>
> SELECT TOP 1
Thanks for all of your answers. I tried a few of the suggestions but they
weren't quite right.
Bill Franklin's answer, while not complete, made me rethink what I was doing
from a different point of view. My error was that I was chaining all of the
record together as though I was trying to se
> Not that I am aware off. But then again, I didn't even know
> that
> uniqueidentifiers had a comparator nowadays and could be
> sorted :)
Yeah, it is hard to keep up with all the changes. Anyway, I may have a around
later. If I actually manage to find a reference, I will post back ;)
-Lei
On Wed, Aug 3, 2011 at 10:13 PM, Leigh wrote:
> Offhand do you know if there are any issues using NEWID() within CTE's? I
> have a vague recollection of issues with that function. Either when used
> within CTE's or possible derived tables. Not sure.
Not that I am aware off. But then again, I di
Offhand do you know if there are any issues using NEWID() within CTE's? I have
a vague recollection of issues with that function. Either when used within
CTE's or possible derived tables. Not sure.
-Leigh
~|
Order the Adobe C
On Wed, Aug 3, 2011 at 9:36 PM, Bill Franklin wrote:
> Why not try something like this...(not sure which database you are using)
>
> SELECT TOP 1 *
> FROM
> (
> SELECT DISTINCT portal_polls.poll_id, portal_polls.question,
> portal_polls.answer1, portal_polls.answer2, portal_polls.answer2,
> because every row in your
> resulting recordset now has a field called fieldC with the
> value of your previously generated ID
That is because a variable is used rather of calling the function directly
within the SELECT list. The latter (usually) forces the function to be
evaluated once per r
On Wed, Aug 3, 2011 at 8:43 PM, Robert Harrison wrote:
> Normally I would use TOP 1 and ORDER BY NEWID() to do this. But it doesn't
> like that with the DISTINCT clase. I'm using DISTINCT because the same poll
> could come up several times if it's allowed in multiple groups and that use
> is i
id and
portal_students_x_polls_completed.student_user_id=#session.userid#);
)
-Original Message-
From: Steve Milburn [mailto:scmilb...@gmail.com]
Sent: Wednesday, August 03, 2011 2:33 PM
To: cf-talk
Subject: Re: COMPLEX SQL RANDOM
The error message you are getting is because the value of your order by
clause, newID
The error message you are getting is because the value of your order by
clause, newID(), is not a part of your list of values you are selecting.
You could, of course, include it in your list of values by first setting it
to a variable, like so:
declare @orderClause as uniqueidentifier;
set @order
> But when I do that it tells me: ORDER BY items must appear
> in the select list if SELECT DISTINCT is specified.
I cannot speak for the query itself, but using a derived table comes to mind as
a possibility.
~|
Order the Adob
> Since the query you have gives you the list of polls that you want, what
> about dumping the results of that query into a temp table, and doing a random
> select on the temp table with SELECT TOP 1 and ORDER BY NEWID() ?
I have considered that, but this should be possible in one straight up S
Since the query you have gives you the list of polls that you want, what
about dumping the results of that query into a temp table, and doing a
random select on the temp table with SELECT TOP 1 and ORDER BY NEWID() ?
Steve
On Wed, Aug 3, 2011 at 2:43 PM, Robert Harrison
wrote:
>
> I have this
What I'm trying to do should look like this:
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,
16 matches
Mail list logo