다음을 통해 공유


How to: Create Self-Joins Automatically

If a table has a reflexive relationship in the database, you can join it to itself automatically.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.

To create a self-join automatically

  1. Add to the Diagram pane the table you want to work with.

  2. Add the same table again, so that the Diagram pane shows the same table twice within the Diagram pane.

    The Query and View Designer assigns an alias to the second instance by adding a sequential number to the table name. In addition, the Query and View Designer creates a join line between the two rectangles representing the two different ways the table participates in the query.

See Also

Other Resources

Querying with Joins