Re: Is there a non-aggregate Max() function in MySQL?

2008-12-14 Thread Seb Duggan
I don't have MySQL installed, but this is how I'd do it in MSSQL (and I don't see why it wouldn't work for you...): SELECT *, OrderValue = CASE WHEN MinPrice MaxPrice THEN MinPrice ELSE MaxPrice END FROM mytable ORDER BY OrderValue DESC Seb Seb Duggan Web

Re: Is there a non-aggregate Max() function in MySQL?

2008-12-14 Thread Stephen Hait
On Sat, Dec 13, 2008 at 10:26 PM, Jim McAtee jmca...@mediaodyssey.comwrote: The max price may not be present and is set to zero when that's the case, so data might look like: 1 5 5 0 3 10 8 0 6 0 I want to order by the larger of the two column values ORDER BY Max(minprice, maxprice)

A few unique random numbers

2008-12-14 Thread Don L
Man, I'm not having a good time with a seemingly simple problem, that is, to generte a bunch of (say, 6) of unique numbers out of a range. Say, the range is 20. My current code technique is mainly to use a 'pool of numbers, each less than 20', if found, try generate a number again (and here's

Re: A few unique random numbers

2008-12-14 Thread Barney Boisvert
numbers = {}; while (structCount(numbers) LT 6) { numbers[randRange(1, 20)] = ; } numbers = structKeyList(numbers); On Sun, Dec 14, 2008 at 3:45 PM, Don L do...@yahoo.com wrote: Man, I'm not having a good time with a seemingly simple problem, that is, to generte a bunch of (say, 6) of unique

Re: A few unique random numbers

2008-12-14 Thread Paul Kukiel
I use this method. Originally I used this to shuffle a deck of cards. cfset ca = arrayNew(1) / cfloop from=1 to=20 index=i cfset ca[i] = i / /cfloop cfset i=1 / cfloop from=1 to=20 index=i cfset ranDom = RandRange(1,arrayLen(ca)) / cfoutput#ca[ranDom]#br //cfoutput cfset

Re: A few unique random numbers

2008-12-14 Thread Barney Boisvert
Off topic now, but if you want to shuffle a deck of cards (or anything else), check out java.util.Collection's shuffle() method. Operates on a CF array (or any other java.util.List). cheers, barneyb On Sun, Dec 14, 2008 at 3:55 PM, Paul Kukiel pkuk...@gmail.com wrote: I use this method.

Re: A few unique random numbers

2008-12-14 Thread Don L
numbers = {}; while (structCount(numbers) LT 6) { numbers[randRange(1, 20)] = ; } numbers = structKeyList(numbers); On Sun, Dec 14, 2008 at 3:45 PM, D Beautiful, thank you very much. Thank you too, Paul. ~| Adobe®

RE: A few unique random numbers

2008-12-14 Thread Jim Davis
-Original Message- From: Barney Boisvert [mailto:bboisv...@gmail.com] Sent: Sunday, December 14, 2008 6:51 PM To: cf-talk Subject: Re: A few unique random numbers numbers = {}; while (structCount(numbers) LT 6) { numbers[randRange(1, 20)] = ; } numbers =

Re: REreplace function for special characters

2008-12-14 Thread Azadi Saryev
[q] FileName = rereplace(FileName, '(?!\.[^.]*$)\W', '', 'all') [/q] well, that is just beautiful! Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic

Re: sum of cfquery with group by

2008-12-14 Thread Azadi Saryev
you can also do: #arraysum(queryname.columnname)# Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Tech Gate wrote: cfquery select a.Dept, c.Assonum . group by a.Dept, c.Assonum /cfquery I need to get the SUM of c.Assonum, but I can't do sum(c.Assonum ) in