Small Query help needed
-
Hi Team, I am having value in a table which contains in this format 180/20, 160/24 I need to show the maximum value and Min value from SQL Query Like if Value is 180/20 then Maximum value =180 Minimum Value =20 Please help me
-
Hi Team, I am having value in a table which contains in this format 180/20, 160/24 I need to show the maximum value and Min value from SQL Query Like if Value is 180/20 then Maximum value =180 Minimum Value =20 Please help me
You want to do it on the SQL query or in your C# code? C# code - Split the text on "/" and get the max and min values from the resultant array. SQL query - select left(ColName, charindex('/', ColName)-1), right(ColName, len(ColName)-charindex('/', ColName)) You will need to test and correct the SQL as necessary.
-
Hi Team, I am having value in a table which contains in this format 180/20, 160/24 I need to show the maximum value and Min value from SQL Query Like if Value is 180/20 then Maximum value =180 Minimum Value =20 Please help me
Try this
SELECT
'maximum valuue='+(SUBSTRING(valstr,1,CHARINDEX('/',valstr)-1 )),
'minimum valuue='+SUBSTRING(valstr,CHARINDEX('/',valstr)+1 ,LEN(valstr))FROM mytable2
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com