My db has a table with a column defined thus:

  body_size text default '0.0'

whose purpose is to hold the size of the item that the row represents. All rows 
contain a value but as a string to one decimal place, not a number. So the 
column contains strings such as '0.0', '3.7', '22.9', etc. All are positive.

Now I want to use the body_size in an ORDER BY so I'll need SQLite to convert 
the values to a float. What will be the best function to use? I'd thought of 
this:

  select col1, col2 from mytable order by round(body_size,1)

however the doc doesn't specify whether round accepts a non-numeric argument. 
Perhaps:

  select col1, col2 from mytable order by abs(body_size)

would be better, but I wonder which is fastest (although speed may not matter 
too much, the typical select shouldn't return more than few thousand rows).


-- 
Cheers  --  Tim
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to