Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
select  * from (Select  REPLACE(LTRIM(REPLACE(cm_submittal_no, '0', ' ')), ' ', '0') orginal
  From prj_detail_submittal order by cm_submittal_no) asc




Is this executes please tell me ...

actuall my idea is i am getting fields by executing the inner select stmt so now i want do again order by

how to make it.. please help me i am in critical position


Thanks in Advance
Posted

try this link

How to use Subqueries[^]
 
Share this answer
 
CREATE TABLE #T
(T INT,
U INT)

INSERT INTO #T
SELECT 1,1
UNION ALL SELECT 2,2
UNION ALL SELECT 3,3
UNION ALL SELECT 4,4

SELECT * FROM (SELECT TOP 100 PERCENT * FROM #T ORDER By U DESC) Tbl ORDER BY Tbl.T DESC
DROP TABLE #T

Actually order by clause in sub suqery wont work if you wont pur TOP 100 PerCENT or its a FOR XML...
The above example will hopfully solve ur problem...
 
Share this answer
 
this should help:

select * from (select top 100 percent REPLACE(LTRIM(REPLACE(cm_submittal_no, '0', ' ')), ' ', '0') original from prj_detail_submittal order by original)t order by t.original asc
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900