OK, thanks for all of the responses.

So I first tried "Order By count(*) desc", did not work I got an
OpenBD error,

Error:
The following error was produced: Encountered "total" at line 7,
column 14. Was expecting one of: <INTEGER_LITERAL> ...
<IDENTIFIER> ... "[" ...

So, i went back and tried a few things. I found that setting the order
by on a normal column in QofQ worked fine, I then aliased a normal
column and then did a Order By on the alias, and that worked as well.
I then contacted a friend who uses CF9 ( I dont have a copy ), and he
said the count(*) works fine for him.

So I tested one more thing, I added one more QofQ statements, and that
worked here it is...

Thanks,
Charlie

<!--- First Query --->
<cfquery name="allUsers" datasource="#APPLICATION.dbSource#">
 select * from users
</cfquery>

<cfquery name="allUsersLogins" dbtype="query">
select loggins, count(*) as total
from allUsers
where account_active = 1
Group By loggins
</cfquery>

<cfquery name="allUsersLogins2" dbtype="query">
select loggins, total
>From allUsersLogins
Order By total Desc
</cfquery>

On Dec 14, 8:09 am, Carl Von Stetten <[email protected]> wrote:
> Charlie,
>
> If QofQ follows the same rules as SQL Server, you cannot reference an
> alias in the order by clause.  Try changing the last line to:
>
> Order By count(*) desc
>
> HTH,
> Carl
>
> On 12/13/2010 5:15 PM, Skellington wrote:
>
>
>
> > Hello,
> > I just wanted to make sure I was not doing something wrong here. When
> > I run the following code all of it work except for the "Order By total
> > Desc". The order by never happens.
>
> > Is this a know issue?
>
> > Thanks,
> > Charlie
>
> > <!--- First Query --->
> > <cfquery name="allUsers" datasource="#APPLICATION.dbSource#">
> >   select * from users
> > </cfquery>
>
> > <cfquery name="allUsersLogins" dbtype="query">
> >   select loggins, count(*) as total from allUsers where account_active
> > = 1
> > Group By loggins
> > Order By total Desc
> > </cfquery>

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 official manual: http://www.openbluedragon.org/manual/
 Ready2Run CFML http://www.openbluedragon.org/openbdjam/

 mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to