October 10, 2013 at 7:05 am
Hai Every One. Can Any body help me Please.
I Want to Write a Query On the Result Set Of Another Query.
How to Write
Can Any body help me Please.
October 10, 2013 at 7:14 am
You mean something like this:
SELECT * FROM
(SELECT * FROM myTable WHERE col = 'A') tmp;
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
October 11, 2013 at 1:53 pm
Maybe something like this
with cte (ID, somefield) as
(
select ID, FieldName from TableA
)
select TableB.Field
from TableB
join cte
on cte.ID = TableB.ID
October 11, 2013 at 3:32 pm
perireddy.arikatla (10/10/2013)
Hai Every One. Can Any body help me Please.
I Want to Write a Query On the Result Set Of Another Query.
How to Write
Can Any body help me Please.
There are a lot of ways to do this. Koen's code demonstrates a "Derived Table". There are other methods, as well.
CTE
Derived Tables (Sub-queries)
Correlated Sub-Queries
Views
Inline Table Valued Functions
APPLY (CROSS or OUTER)
Temp Tables
INSERT/EXEC
OpenRowSet
OpenDataSource
--Jeff Moden
Change is inevitable... Change for the better is not.
October 11, 2013 at 4:10 pm
As Jeff showed there are many ways to do this. I only provided one possibility.
I've been a silent observer on this site for along time and finally feel that I have some knowledge to begin offering solutions to some questions. 🙂
October 12, 2013 at 9:04 am
lrosini (10/11/2013)
As Jeff showed there are many ways to do this. I only provided one possibility.I've been a silent observer on this site for along time and finally feel that I have some knowledge to begin offering solutions to some questions. 🙂
Ver y cool. Welcome to the fun. 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply