You could <cfparam name="form.city" default="0" /> select distinct city from properties where lower(city) != '#lcase(form.city)#' -- USE <CFQUERYPARAM :)
then <select name="city" multiple="true" size="5"> <option value="0" <cfif form.city eq 0>selected</cfif>> -- select a city --</option> <cfoutput query="cities"> .... .... </cfoutput> </select> This would put the selected city at the top But then again you could use the union select city, orderby from ( select city, 1 as orderby from properties where city = form.city union select city 2 as orderby from properties where city != form.city ) order by orderby, city That would place your city at top On Mon, Jul 7, 2008 at 3:22 PM, Rick Faircloth <[EMAIL PROTECTED]> wrote: > Whoa, that's a dandy little query! > > I see you've got "from table"... the cities are > pulled from a properties table via > "select distinct city from properties" > > I guess I could use a QoQ in place of the table > as the datasource. > > However, you mentioned that your query would > "tack the prior cities onto the end" and I would > prefer to keep the selected cities in the order > they are naturally and reduce the chance of confusing > the user. > > It may be that the only way I can do this without jQuery > would be to run a query that returns the names of the > cities selected and then place them on top. Then run > another query to get all the cities in order. (Which > seems to be what your single query does, too, Greg). > Usually, I put the selected item in a single select > on top and then list the rest, including the selected > item again after that. > > Guess that would work ok. > > >> -----Original Message----- >> From: Greg Morphis [mailto:[EMAIL PROTECTED] >> Sent: Monday, July 07, 2008 3:35 PM >> To: CF-Talk >> Subject: Re: Is there a way to do this? >> >> You could do something like (not tested) >> select distinct city, orderby from ( >> select city, 2 as orderby >> from table >> where city < foo_city >> union >> select city, 1 as orderby >> from table >> where city >= foo_city >> ) order by orderby, city >> >> that would tack the prior cities onto the end >> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:308701 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4