SQL Server sub query

New to SQL Server, need to write this sql statement (Oracle Format) in SQL SERver


SELECT count(*) FROM
(SELECT empno, ename, JOB, sal FROM emp)
LVL 11
mohammadzahidAsked:
Who is Participating?
 
Steve WalesConnect With a Mentor Senior Database AdministratorCommented:
Do this:

SELECT count(*) FROM
(SELECT empno, ename, JOB, sal FROM emp) as a

Open in new window


SQL Server requires inline selects like that to be aliased, even if you're not using the alias in the columns being selected.
0
 
mohammadzahidAuthor Commented:
Thank you. Solution worked as I was hoping.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.