How to Work With Self Join in SQL

In this article I am going to explain about how to work with self join.
  • 1718

Introduction

Here I am going to explain about how to work with self join. A self join is a join where a table is joined with itself. In example of self join we use same table two time but we make him different using correlation name. We use DISTINCT clause in statement to delete duplicate rows.

A Statement that create mcninvoices table

ven.jpg

Statements that insert data in mcninvoices table

ven (1).jpg

A Statement that is used to fetch data from mcninvoices table

ven (2).jpg

A Statement that work with self join

Clipboard08.jpg


© 2013 dotNetheaven. All rights reserved.