Home   Fees/Services   Access Templates   Tutorials  Tutorial Downloads   Articles   Search   Contact  Privacy  Links
SQL Self Join
SQL Self Join Query Examples
Home > Tutorials > Query Tutorials > Self Join Query

Query Tutorials Index:
Too Complex Query
Aggregate Query
Not In Operator
Choose Function
Crosstab Query
Date Time Query
Delete Query
External Table Query
Report Filter Query
Group By Query
Having Query Clause
Histogram Query
Access Append Query
Master Detail Update
Order By Query
SQL Parameter Query
Predicate Query
Self Join Query
Scalar SubQuery
Master Detail Query
Select Query
Select Top
Union Query
SQL Update Query
Custom Query Function


MultiSelect Parameter Forms Query Tutorial

Self Join

SQL Self Join Example

Access self join:  In this update query example we use the self join query technique to update each employee's salary by 10%.  There are at least two ways to do this update. Example c) (below) is supposed to work but I get errors in Access.  It is called a correlated subquery - if you can tell me what is wrong with it I'd really appreciate it.

Our programming team has 15 members containing a wide variety of technical database knowledge and programming experience. We are kind of like Allstate Insurance - 'we have seen it before'.

We create databases large and small. Some of our databases help run entire small businesses including travel agencies and airline reservation systems. We also handle unique businesses such as fly rod manufacturing. Did you know there are 11 steps in the making of a fly rod?

Self Join Query Code:

a)  Update M_Emp as A INNER JOIN M_Emp as B ON A.Emp_ID = B.Emp_ID SET A.Salary = B.Salary*1.1

b)  Update M_Emp as A, M_Emp as B Set A.Salary=B.Salary * 1.1
Where A.Emp_ID=B.Emp_ID

c)  Update M_Emp as A set A.Salary = (Select Salary * 1.1 from M_Emp Where M_Emp.Emp_ID = A.Emp_ID)

Note:  I have added a another feature to this self join query example - Aliases.  Aliases are where you use 'as' to establish a short nickname for a table or a field.  This alias feature helps when you have long table names or are trying to do a correlated subquery.

Additional One Table/Same Table Update Examples:

Self Join in Visual Basic Detail Master Update

Table Data in Access

Access Self Join Query for Inventory Calculations Example

A Blue Claw Software Design Template:

Loan Process Management Access Database

A Blue Claw Database Design Article:

Microsoft Access On The Internet

Blue Claw Database Design Downloadable Tutorial:
Union Query (Advanced) Access Tutorial Download  

Microsoft Office:
MS Access 2000 Through Access 2016 & Office 365

Contact Information

Copyright 2000-2017 Blue Claw Database Design