select * from (select) | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

select * from (select)

Is there a problem in the way I am calling this query: select * from (
select * from authors) I am getting an error: Line 2: Incorrect syntax near ‘)’ Pl suggest. Thanx

May be you coult tell us what do you want to do, because that does not work. Somthing like: insert into A (select * from B) will work.
Luis Martin
Moderator
SQL-Server-Performance.com One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell
All postings are provided “AS IS” with no warranties for accuracy.
You have to use alias name select * from (
select * from authors) T Madhivanan Failing to plan is Planning to fail
Why you are using same query.
simply use select * from authors.
generally use derived table method to get different set of resultset and combining all together.
Your sample doesn’t make too much sense. [<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ />]<br />Compare the execution plans and you’ll see that in cour case you’ll lose nothing, but you’ll also gain nothing for your query compared to a simple SELECT * FROM authors. SQL Server generates identical execution plan. The optimizer is actually smart enough to realize that a straight SELECT * will produce the same resultset. But this might not always be the case. <br />Any specific reason for your question?<br /><br />–<br />Frank Kalis<br />Microsoft SQL Server MVP<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />Ich unterstütze PASS Deutschland e.V. <a target="_blank" href=http://www.sqlpass.de>http://www.sqlpass.de</a>) <br />
I think he wants to use derived table
Thats why he posted a question like this
Madhivanan Failing to plan is Planning to fail
Yes, I wanted to use a derived table and the table alias thing worked. Thanx Madhivanan.
]]>