Solved

SQL Server sub query

Posted on 2012-12-20
2
495 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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

809 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