i have table house no like this below coloum.........
house_no
3-13-10
3-13-200/a
3-13-450/a
3-13-1345/b
3-13-4
3-13-567/c
3-13-832/a
3-13-943
i want table like this....
3-13-4
3-13-10
3-13-200/a
3-13-450/a
3-13-567/c
3-13-832/a
3-13-943
3-13-1345/b
pl write the quarie
Loading

Arunkumar T V13 reputationPosted Dec 2, 2013, 1:30 AM EST
Please try the following query and let me know. Hope it works.
SELECT Q.no
FROM (
SELECT CONVERT( SUBSTRING_INDEX( SUBSTRING_INDEX( no, '-', - 1 ) , '/', 1 ) , UNSIGNED ) AS part1, no
FROM house_no
ORDER BY part1
) AS Q
Regards
Arunkumar.T.V
JAYRAMRank #7,836 · 233 reputationPosted Dec 2, 2013, 5:50 PM EST
but it shows error like .......
Arunkumar T V13 reputationPosted Dec 2, 2013, 7:03 PM EST
You have added one extra closing bracket near 1. Kindly remove it and check once.
JAYRAMRank #7,836 · 233 reputationPosted Dec 2, 2013, 7:19 PM EST
FROM (
SELECT CONVERT( SUBSTRING_INDEX( SUBSTRING_INDEX( house_no, '-', - 1 ) , '/', 1 ) , UNSIGNED ) AS part1,house_no
FROM Table_name
ORDER BY part1
) AS Q
again it shows error like .....
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '('.
Arunkumar T V13 reputationPosted Dec 2, 2013, 7:45 PM EST
Kindly let me know which database you are using.
JAYRAMRank #7,836 · 233 reputationPosted Dec 2, 2013, 8:26 PM EST