Hello!!
I have a column app_Id in a table.
It has values like
10/2000
10/2001
17/2001
32/2009
89/2011
What i have to do is sort app_id. Part before '/' is the application number and after '/' is year.
so i thought to sort i should make two columns in my datatable each for appNumber and year.
Then i used this query
SELECT [app_id], (Select LEFT(app_Id, CHARINDEX('/',app_Id )-1)) as Number,(Select Right(app_Id, CHARINDEX('/',app_Id )+1)) as Year ,[app_type], convert(varchar,[app_date],103) as app_date, [subject], [app_name], [gar_name], [source_vill], [source_place], [source_dist], [mode], [epat_letno],[status] ,Approved FROM [viv_app] where FinancialYear <>'2012-2013' and Status='Sent to treasury' order by [Year] desc ,Number DESC
Now the problem that i am facing is that for app_id like
10/2000
i am getting Number = 10 and year =2010 which is right but for some values of app_id like
5/2011
i am getting number =5 but year =011 and for app_id like
378/2011
i am getting number =378 but Year= /2011.
please tell me how to solve this logical error