If your database supports it, you can also use CASE to change your sort
order.
SELECT
col1
,col2
CASE WHEN col1 IS NULL THEN 99
ELSE col1
END AS sortOrder
FROM
table
ORDER BY
sortOrder
I have found that this comes in very handy when trying to re-arrange the
order of data that may not make sense sorted alphabetically.
Mike
-----Original Message-----
From: Les Mizzell [mailto:[EMAIL PROTECTED]
Sent: Friday, September 12, 2008 3:59 PM
To: CF-Talk
Subject: Re: A Little Confusion on CFQUERYPARAM and Nulls...
Qing Xia wrote:> then simply do:
> <cfif LEN((TRIM(form["sortORD_#myIDX#"]))>
> link_sort = <cfqueryparam value="#Form["sortORD_#myIDX#"]#"
> cfsqltype="CF_SQL_VARCHAR">
> </cfif>
Yea, was hoping to avoid all those extra cfif statements and keep it a
little neater. Oh well!!
The reason for the default "99" (or whatever) was to give the sorting
column a high number value so record with an actual sort number
(1,2,3,4,5...) would come up first. This leads me to my *other* option -
go ahead an insert the NULL and then use coalesce on the output query to
keep those pesky records with no sort number at the bottom of the pile.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312473
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4