I have a column in a SQL Server table that has the following rows:
MyColumn :
1 Month
2 Week
10 Minutes
1 week
12 hours
1 days
2 month
2 day
5 minutes
1 hours
It is a text column that contains Priority strings.
Is there a way to make a select return this column ordered as following:
10 Minutes
5 minutes
1 hours
10 Hours
1 day
2 days
1 week
2 weeks
1 month
2 months
etc..
thank you
AmountDisplay AS CAST(Value AS varchar(10)) + ' ' + Unit + CASE Value WHEN 1 THEN '' ELSE 's' ENDor something like that. Thus, you would store10intoValue, Minute` intoUnitand read10 MinutesfromAmountDisplay. And it would then be easier to introduce custom sorting, like the kind you are asking about.