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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Display proper in ascending
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Cursor join
Starting Member

8 Posts

Posted - 01/10/2013 :  10:44:23  Show Profile  Reply with Quote
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 - 01/10/2013 :  10:48:37  Show Profile  Reply with Quote
pls suggest.
Go to Top of Page

Cursor join
Starting Member

8 Posts

Posted - 01/10/2013 :  12:17:58  Show Profile  Reply with Quote
??
Go to Top of Page

webfred
Flowing Fount of Yak Knowledge

Germany
8781 Posts

Posted - 01/10/2013 :  13:04:08  Show Profile  Visit webfred's Homepage  Reply with Quote
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 - 01/10/2013 :  13:04:46  Show Profile  Reply with Quote
me only providing the solution..

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

webfred
Flowing Fount of Yak Knowledge

Germany
8781 Posts

Posted - 01/10/2013 :  13:11:27  Show Profile  Visit webfred's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000