Yes the ordering is the only problem i have seen so far but i´m concerned that the >= ? might cause problems to? It seems to work but since it orders the results wrong can i be sure that it will always do this correct for me?
In the ordering it seems like mysql thinks that 80Gb is larger than 120 and 250. And my concerne is that i might be situations where it thinks that 80 should be returned when doing a >=120. Quoting Michael Stassen <[EMAIL PROTECTED]>: > Test USER wrote: > > Hi again :) > > > > The table contains a column named value and is in the format > varchar(255). > > This column contains specifications for different computer products. > > There is also a id column so i know which product it belongs to. > > > > value(varchar) > > 80 > > 17" > > 1024x768 > > USB > > DiVX > > > > For example, the first value 80 tells me with som joins that the > product maxtor > > diamondmax has 80Gb capacity. And that a Philips DVD-player supports > DiVX for > > the last value in this example. > > > > Now i want to select all harddrvies with a capacity greater or equal > to 80. > > Doing a "select value from tbl where value >=80 order by value DESC" > will give > > some unexpected results. > > > > If you have 80, 120, 250 in the database the result will be: > > 80 > > 250 > > 120 > > > > I don't really know how to solve this other than to use CAST(value as > SIGNED). > > Maybe i could rebuild the database but i don't know how a good > databasedesign > > for this would look like :) > > Is the ordering your only concern? Your value column is a string, so > your > results are ordered alphabetically rather than numerically. If all you > want is > numeric ordering, you need to tell mysql to treat value as a number in > the order by: > > SELECT value FROM tbl WHERE value >=80 ORDER BY value+0 DESC; > > Michael > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > ------------------------------------------------- FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]