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 2008 Forums
 Transact-SQL (2008)
 Resultant reuse

Author  Topic 

Indsqlbeginner
Starting Member

21 Posts

Posted - 2013-12-30 : 07:31:29
Hi

need your help please.
sample query

select a,b,c from tablea where a in ('m','n','f')

The above one is being used as a subquery in two different places.

i'm thining to dump this result set in a temporary table and apply it as a inner join with the table wherever it is required..but still the performace is same,any idea of better way of doing it to improve the performacen. am i clear?Thanks

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2013-12-30 : 07:37:00
If the resulting temporary table is large you can add indexes.

djj
Go to Top of Page

Indsqlbeginner
Starting Member

21 Posts

Posted - 2013-12-30 : 07:44:12
quote:
Originally posted by djj55

If the resulting temporary table is large you can add indexes.

djj



Thanks for ur time. whether will it be called as a subquery to yield the required result wherever it's needed or just dump the subquery result once in a temp table.After this,wherever this(temp) is needed we can inner join them with the table..
Go to Top of Page
   

- Advertisement -