Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Quering a query!!!

Author  Topic 

sillylady
Starting Member

13 Posts

Posted - 2007-01-11 : 06:07:15
Is it possible to quering a query? For example:

Select (Field1+Field2+Field3) As [Result1], (Field4+Field5) As [Result2], Field6, Field7 from Table.

Is it possible to run a query (selecting Result1 and Result2) against this query.





harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-11 : 06:11:19
Yes, by creating first query as a derived table.

Select Result1, Result2
From
(
Select (Field1+Field2+Field3) As [Result1], (Field4+Field5) As [Result2], Field6, Field7
from Table) t


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-11 : 06:46:21
Tell us what you really are up to. There is no need to do this simple query with a derived table.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

sillylady
Starting Member

13 Posts

Posted - 2007-01-14 : 01:39:15
quote:
Originally posted by Peso

Tell us what you really are up to. There is no need to do this simple query with a derived table.


Peter Larsson
Helsingborg, Sweden




As I said in my posting that those Result1 and Result2 will be compared with values from another table filelds and another set of calculation will be done.

Go to Top of Page
   

- Advertisement -