This might help... to quote Bert Bawson from a fusebox list on topica that
found its way into my KB,...

If you're using SQLserver then you can use a case statement and a dummy
column:

SELECT  my_col
    ,   CASE Left(my_col,1)
            WHEN 'P' THEN 1
            WHEN 'O' THEN 2
              ELSE  3
        END     AS      myorderby
FROM    my_table
ORDER BY 
        myorderby


Cheers,

Scott.
        
-----Original Message-----
From: Hickman, Matt [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 10 September 2003 12:04 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Order by Lists variables


dealing with poorly designed DB, so i'm trying to work with what i've got, 

yes it was a typo
-----Original Message-----
From: Phil Evans [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 10 September 2003 11:59 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Order by Lists variables


Another thought:

If there are specific sublists that need to be selected in a particular
order, then there really should be a separate table in the database, with
ListId, SortOrder, and StoryHeading.

You could then link from this new table to your existing one, selecting on
listid, and sort on the sort_order

HTH 
Phil


----- Original Message ----- 
From: Phil Evans 
To: CFAussie Mailing List 
Sent: Wednesday, September 10, 2003 11:48 AM
Subject: [cfaussie] Re: Order by Lists variables


The only way I can think of is to use cfloop run through the list, and
execute a separate query to get the records individually.
You could then store the output in a list or array, and process as required.

Phil.
----- Original Message ----- 
From: Hickman, Matt 
To: CFAussie Mailing List 
Sent: Wednesday, September 10, 2003 11:42 AM
Subject: [cfaussie] Re: Order by Lists variables


The data in on SQLServer2000

I want to order by the list, which is in fact the "storyheader" not PK, or
date.


-----Original Message-----
From: Phil Evans [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 10 September 2003 11:39 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Order by Lists variables


Matt,

You will need the order by clause to guarantee the order you want.
Depending on the dbms, (and time of day and phase of the moon), the default
order can be:
1. Order records were created
2. Primary key order
3. Last modified date
4. Index being used to access records

Basically, if the order is important, put an ORDER BY clause on your select.

Phil.

----- Original Message ----- 
From: Hickman, Matt 
To: CFAussie Mailing List 
Sent: Wednesday, September 10, 2003 11:28 AM
Subject: [cfaussie] Order by Lists variables


Hi all quick one hopefully,

Look at my code below and tell me why my cfdump is not odering the query
based on the list?? If I don't use the "ORDER BY" clause in my SQL does the
query use a default ordering or should the list be defining the order??? Can
i use the list as the "ORDER" instead???

<cfif #URL.treatment# is "VIP">
<cfset treatment="187, 948, 968, 958, 973, 963, 969, 953, 977">
</cfif>
                                                               
<cfset dataPageID="2312">
<!--- run query using the list info above --->                 
<cfquery name="qgetTreatments" datasource="#application.DSN#">
SELECT  STORYHEADING, STORYHTML
FROM    #Application.tablePrefix#TABLESTORY
WHERE   PAGEID = '#dataPageID#'
AND      STORYHEADING IN (#treatment#)  
</cfquery>

Here's the output of my dump:
STORYHEADINGSTORYHTML
187 Welcome to Vodafone. As you are a VIP customer, we will be with your
shortly 
977 Hi, were really close to speaking with you. We're sorry for the delay
and wont be long 
973 As we race to answer your call, did you know that formula 1 world champ,
Michael Schumacher holds the record for the most races won by any driver? 67
and counting! 
969 Thanks for waiting, were flat out at the moment, we'll be at your
service as soon as possible 
968 Thanks for waiting, were flat out at the moment but someone will be
right with you 
963 Snap a pxt in brilliant colour! Add a txt message and a voice or music
clip! And send it straight to your friends vodafone live mobile! Check out
vodafone.com.au for an interactive demo, or chat to us now 
958 Stay tuned with a choice of over 1600 awesome polyphonic ringtones with
Vodafone live. From pop to rock, hip hop to dance. Now that's a serious
amount of music 
953 How would you like your voicemail to ring you when you have a new
message? To activate ring alert, just dial 1219 which is free from your
mobile! 
948 How would you like your voicemail to ring you when you have a new
message? To activate ring alert, just dial 1219 which is free from your
mobile! 





**********************************************************************
A new world of colour, sound and pictures awaits you:
Vodafone Live! More details at http://www.vodafone.com.au/live/

**********************************************************************"
This correspondence is for the named person's use only. It may
contain confidential or legally privileged information or both. "
No confidentiality or privilege is waived or lost by any "
mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You 
must not disclose, copy or rely on any part of this correspondence 
if you are not the intended recipient. 

Any views expressed in this message are those of the individual sender,
except where the sender expressly, and with authority, states them to
be the views of Vodafone.

This email has been checked for viruses.
****************************************************************************
******************
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/ 
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/ 


**********************************************************************
A new world of colour, sound and pictures awaits you:
Vodafone Live! More details at http://www.vodafone.com.au/live/

**********************************************************************"
This correspondence is for the named person's use only. It may
contain confidential or legally privileged information or both. "
No confidentiality or privilege is waived or lost by any "
mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You 
must not disclose, copy or rely on any part of this correspondence 
if you are not the intended recipient. 

Any views expressed in this message are those of the individual sender,
except where the sender expressly, and with authority, states them to
be the views of Vodafone.

This email has been checked for viruses.
****************************************************************************
******************
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/ 
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/ 
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/ 


**********************************************************************
A new world of colour, sound and pictures awaits you:
Vodafone Live! More details at http://www.vodafone.com.au/live/

**********************************************************************"
This correspondence is for the named person's use only. It may
contain confidential or legally privileged information or both. "
No confidentiality or privilege is waived or lost by any "
mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You 
must not disclose, copy or rely on any part of this correspondence 
if you are not the intended recipient. 

Any views expressed in this message are those of the individual sender,
except where the sender expressly, and with authority, states them to
be the views of Vodafone.

This email has been checked for viruses.
****************************************************************************
******************
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/ 


IMPORTANT NOTICE:
This e-mail and any attachment to it is intended only to be read or used by
the named addressee.  It is confidential and may contain legally privileged
information.  No confidentiality or privilege is waived or lost by any
mistaken transmission to you.  If you receive this e-mail in error, please
immediately delete it from your system and notify the sender.  You must not
disclose, copy or use any part of this e-mail if you are not the intended
recipient.  The RTA is not responsible for any unauthorised alterations to
this e-mail or attachment to it.  

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to