Forum Moderators: open
13.24
14.24
as low as 14.9
8.90
as low as 7.9
I need to be able to sort these interest rates from lowest to highest. so far, i have come up with this, but it's not sorting correctly:
select case
when upper(left(interest_rate,10)) = 'AS LOW AS ' then substr(interest_rate,11) else interest_rate end conv_interest_rate from rate_table order by conv_interest_rate asc;
thanks in advance.
alter table mytable modify int_rates decimal (12,2) not null default '0.00';
select (case when upper(left(interest_rate,10)) = 'AS LOW AS' then substr(interest_rate,11) else interest_rate end)+0 conv_interest_rate from rate_table order by conv_interest_rate desc;
the "+0" converts varchar to numeric for sorting in mysql versions prior to 5.0