# Make a copy of a subquery in the same query **Category:** [Epicor ERP 10](https://www.epiusers.help/c/e10/5) **Created:** 2016-11-02 19:02 UTC **Views:** 1938 **Replies:** 4 **URL:** https://www.epiusers.help/t/make-a-copy-of-a-subquery-in-the-same-query/36071 --- ## Post #1 by @CDP Epicor 10.1.400.21 I am writing a query to compare territory sales from this year against last year. I have written a subquery that calculates this year's sales. Is there a way to make a copy of this subquery in the same query or do I have to write the whole thing out again? Cheers, Charlie Payne Hendrick Screen Company --- ## Post #2 by @duckor I think you're out of luck unless there's something you can do with an executive query. Does it have to be within Epicor? Can you use Report Manager? Otherwise I think its rebuilding time. --- ## Post #3 by @amaragni i believe you'll need to reenter the query --- ## Post #4 by @knash If you create the subquery to be all of your data. Then you can create a main query and use the subquery twice. One to join on current year and another that joins on last year. --- ## Post #6 by @CDP Thank you - that worked very nicely. --- **Canonical:** https://www.epiusers.help/t/make-a-copy-of-a-subquery-in-the-same-query/36071 **Original content:** https://www.epiusers.help/t/make-a-copy-of-a-subquery-in-the-same-query/36071