• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 49
  • Last Modified:

inner join between 2 long queries

Hi Experts
how can i write an inner join between 2 long SQL queries

Thank you
1 Solution
ste5anSenior DeveloperCommented:
The  simple solution is using common table expressions (CTE). Here you simply wrap up your separate queries as expressions. Then you can use them like views:

WITH Courses
AS ( yourCoursesQuery ) ,
AS ( yourRequestQuery )
FROM   Courses C
       INNER JOIN Requests R ON C.KeyColumns = R.KeyColumns;

Open in new window

Depending on the performance and structure of your queries, the old-school approach is still the better: Just combine both queries manually in one.
AZZA-KHAMEESAuthor Commented:
thank you for the answer, also i was enable to create a temp table and run the query :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now