Subqueries in the From clause

Subqueries in the FROM clause are represented as table controls on the diagram. They can be treated exactly as tables.

Creating Subqueries

To create a new subquery:

In the query document, do either of these actions to open the SubQuery tab:

  • Right-click the diagram and choose Create Subquery from the shortcut menu.
  • Click the Create Subquery button on the Query toolbar.
  • Select Create Subquery from the Query menu.

The SubQuery tab appears where you can create the subquery - add a table, select required columns, specify conditions, etc.

You can include a table into a subquery in two clicks. Just right-click a table on the diagram, and select Wrap to Subquery item from the menu. The table shape will change its color and the subquery will be added to the query. You can add an alias to your subquery by typing it into the caption of subquery table shape. When the subquery is created, you can switch to the Text view to check the code.

To quickly navigate to your main query and subquery, use the tabs of the query document or open the Document Outline window.

To edit a subquery, click Query Button on the subquery title bar or right-click the subquery and select Edit Subquery from the shortcut menu.

To rename a subquery, double-click its title and enter a required alias.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Studio in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Studio for your business, request a demo to see it in action.
Ready to start using dbForge Studio for SQL Server?