Re: Subqueries in SQL Server
- From: "Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@xxxxxxxxxx>
- Date: Fri, 12 Jan 2007 08:07:49 +0100
Is there any similar statement in SQL Server for the below Oracle query
SELECT ENAME FROM (SELECT ENAME FROM EMP WHERE DEPTNO = 10)
WHERE SUBSTR(ENAME,1,4) = 'SAHU';
Yes, these are called derived tables in SQL Server. Actually, if you change
the SUBSTR function to SUBSTRING, i think your query should work in SQL
Server.
In addition, SQL Server 2005 has also subqueries in the WITH prolog of the
SELECT statement called Common Table Expressions. They can be more
eefficient that derived tables, if you have to refer to the same subquery
more than once.
--
Dejan Sarka
http://www.solidqualitylearning.com/blogs/
.
- References:
- Subqueries in SQL Server
- From: sangu_rao
- Subqueries in SQL Server
- Prev by Date: Subqueries in SQL Server
- Next by Date: why my asp script failes to process DTS with access database connection?
- Previous by thread: Subqueries in SQL Server
- Next by thread: Re: Subqueries in SQL Server
- Index(es):
Relevant Pages
|
Loading