Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL Server sub query

Posted on 2012-12-20
2
Medium Priority
?
502 Views
Last Modified: 2012-12-20
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)
0
Comment
Question by:mohammadzahid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
Steve Wales earned 2000 total points
ID: 38711550
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
 
LVL 11

Author Closing Comment

by:mohammadzahid
ID: 38711565
Thank you. Solution worked as I was hoping.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Viewers will learn how the fundamental information of how to create a table.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question