Thanks for everyone's replies.

I ran the query and a <cfoutput> to see what it spat out, without including
the template, and it worked fine as it should.  So the problem seems to be
in the template (it queries viewed_numbers which must be causing problems),

Cheers anyway

Will
--
[EMAIL PROTECTED] -=- www.lukrative.com
Local-Advertising -=- www.localbounty.com

----- Original Message -----
From: ""Angel Stewart"" <[EMAIL PROTECTED]>
Newsgroups: dotcom.lists.cftalk
Sent: Thursday, April 05, 2001 12:33 AM
Subject: RE: "Order By" being ignored


> hmm..I believe with two tables you need to put the Number of the column,
> rather than the column name that you want to sort by.
> So do a simple CFOUTPUT of the results to see how the columns are ordered,
> count the column number for Times..and use
>
> ORDER BY 6 DESC instead of order by Times..
>
> Umm...I believe..
>
> if I'm wrong someone feel free to jump in :)
>
> -Gel
>
>
> -----Original Message-----
> From: W Luke [mailto:[EMAIL PROTECTED]]
> Hi,
>
> I hope someone can point me in the right direction for thie query...
>
> Querying 2 tables, and I want to order the results from the
> viewed_numbers.times table, in descending order.  So I did this (using *
as
> the tables are both small)
>
> <cfquery name="getadvert" datasource="localads">
>  SELECT * FROM advert_details, viewed_numbers
>  WHERE advert_details.ID = viewed_numbers.adID
>  ORDER by times DESC
>  </cfquery>
>
> It returns the results, but isn't following my ORDER by statement - they
> appear to be randomly displayed.
>
> What am I doing wrong?
>
> Cheers
>
> Will
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to