What's the data type of the times column, and do you have the times column
in more than one table?

I've done this kind of order by on hundreds of multi-tabl queries without
ever having to use a column number. I have, however, had quite a few similar
problems when I've accidentally set the column datatype incorrectly

-----Original Message-----
From: Angel Stewart [mailto:[EMAIL PROTECTED]]
Sent: 04 April 2001 22:24
To: CF-Talk
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