SQL Server: How to order by nested -


i use sql server 2012 , trying sort results of following query names subquery sql execution error.

can tell me doing wrong or missing here ?

my query:

select a.empid,        (select b.empid, b.lastname + ', ' + b.firstname tm         dbo.emptable b         b.supempid = a.empid)  dbo.emptable  a.ntid = 'someid' order b.lastname + ', ' + b.firstname 

many in advance this, tim.

you returning more 1 column in correlated subquery in columnlist. should give error

only 1 expression can specified in select list when subquery not introduced exists.

how using join instead of subquery?

select a.empid,        b.lastname + ', ' + b.firstname tm dbo.emptable   inner join dbo.emptable b     on b.supempid = a.empid a.ntid = 'someid' order b.lastname + ', ' + b.firstname 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -