Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Display proper in ascending

Author  Topic 

Cursor join
Starting Member

8 Posts

Posted - 2013-01-10 : 10:44:23
SELECT Employee_ID,EMployee_Name, city

FROM city INNER JOIN Employees ON
city.Employee_Id_fk = _Employees.vc_Employee_id_pk
order by Employees.Employee_id asc
here is my query
iwant the out put like
1 a
2 b
11 c
22 d
but my o/p is like
1 a
11 c
2 bc
22 d

Cursor join
Starting Member

8 Posts

Posted - 2013-01-10 : 10:48:37
pls suggest.
Go to Top of Page

Cursor join
Starting Member

8 Posts

Posted - 2013-01-10 : 12:17:58
??
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-01-10 : 13:04:08
SELECT Employee_ID,EMployee_Name, city

FROM city INNER JOIN Employees ON
city.Employee_Id_fk = _Employees.vc_Employee_id_pk
order by convert(int,Employees.Employee_id) asc



Too old to Rock'n'Roll too young to die.
Go to Top of Page

Cursor join
Starting Member

8 Posts

Posted - 2013-01-10 : 13:04:46
me only providing the solution..

EMP ID is defined with varchar data type
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-01-10 : 13:11:27
If you can't convert to int like I suggested above then try this:

order by len(Employees.Employee_id), Employees.Employee_id


Too old to Rock'n'Roll too young to die.
Go to Top of Page
   

- Advertisement -