By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,962 Members | 2,545 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,962 IT Pros & Developers. It's quick & easy.

SMSS Sequential Queries using the same filters

P: 1
I have an question. I have a script that basically runs two queries in the same process. One query tabulates member counts (based on the where filters) then combines that with their cost data in the second query (using where filters). I receive one table. Is there a way to write it in code to have only one set of where filters, whereby the second query relies on the first queries where filters? This way I only have to modify it once?
3 Weeks Ago #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,366
Probably, yes.

We would need to see your code.
3 Weeks Ago #2

NeoPa
Expert Mod 15k+
P: 31,492
You may be able to make use of a CTE (Common Table Expression) but, as Rabbit says, we'd need to see your code.
3 Weeks Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.