By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,115 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,115 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?
Sep 20 '19 #1
Share this Question
Share on Google+
2 Replies

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

We would need to see your code.
Sep 20 '19 #2

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

Post your reply

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