• JoNTSQLSrv (7/28/2016)


    Sergiy (7/28/2016)


    Can you be more specific about the term "completely different logic"?

    Are the tables at least the same for those different logics?

    Thanks for your reply Sergiy, i meant 'completly different logic' because count and grouping them for another set which is in different tables ( no ways to join )

    we can use #temp but still i wanted to do it in a query without #temp table. Is there any option that we can combine both in a single row result ?

    If you are attempting to merge two quite different queries, then why not reduce the number of guesses and post the queries? This article [/url]will help you to understand that forum communication works differently to face-to-face.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden