I have the below content inside a table in SQL

I tried to order by title but I didn't work, is there any SQL statement to use so I can order by the number inside InterSciences Competition?
You can try like following query.
;WITH cte
AS (SELECT title,
Cast(Substring(title, Charindex('(', title) + 1,
Charindex(')', title) -
Charindex('(', title) - 1)
AS INT) AS OC
FROM yourtable)
SELECT *
FROM cte
ORDER BY oc
In above query, the number between brackets is extracted and converted to INT for ordering.
Online Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With