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
Solved

SQL Server sub query

Posted on 2012-12-20
2
496 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
2 Comments
 
LVL 22

Accepted Solution

by:
Steve Wales earned 500 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

860 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