how to order a field based on two parts of the row value I have a field with contents of the form 
22/4,
30/8,
30/5,
30/3

I want it ordered in the form 
22/4,
30/3,
30/5,
30/8

with the part after / ordered if the part before / is same!

Please help!!
A way to order such string is  

Step1: Create Split Function

CREATE FUNCTION [dbo].[fnSplit]
(
@List VARCHAR(8000),
@Delimiter CHAR(1) = ','
)
RETURNS @Temp1 TABLE
(
ItemId INT IDENTITY(1, 1)
NOT NULL
PRIMARY KEY,
Item VARCHAR(8000) NULL
)
AS BEGIN

DECLARE @item VARCHAR(4000),
@iPos INT

SET @Delimiter = ISNULL(@Delimiter, ',')
SET @List = RTRIM(LTRIM(@List))

-- check for final delimiter
IF RIGHT(@List, 1) &lt;&gt; @Delimiter 
-- append final delimiter
SELECT @List = @List + @Delimiter

-- get position of first element
SELECT @iPos = CHARINDEX(@Delimiter, @List, 1)

WHILE @iPos &gt; 0
BEGIN
-- get item
SELECT @item = LTRIM(RTRIM(SUBSTRING(@List, 1, @iPos - 1)))
IF @@ERROR &lt;&gt; 0 
BREAK
-- remove item form list
SELECT @List = SUBSTRING(@List, @iPos + 1, LEN(@List) - @iPos + 1)
IF @@ERROR &lt;&gt; 0 
BREAK
-- insert item
INSERT @Temp1
VALUES ( @item )
IF @@ERROR &lt;&gt; 0 
BREAK
-- get position pf next item
SELECT @iPos = CHARINDEX(@Delimiter, @List, 1)
IF @@ERROR &lt;&gt; 0 
BREAK
END
RETURN
END

GO


Step2: split the string into tokens 

create table #string
(
field varchar(500)
)

insert into #string
select '22/4, 30/3, 30/5, 30/8,40/9,40/3'

----------------Order by string Tokens returned by function
select * 
from #string cross apply dbo.[fnSplit](field,',') atn
order by ltrim(rtrim(atn.Item ))

drop table #string