Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with left outer join using three tables

Status
Not open for further replies.

vc1881

Programmer
Nov 9, 2008
32
US
Hello,

I would like to join 3 tables based on a common field. Table 1 should always have data, but data from tables 2 and 3 will not always be available, can you please help me with the left outer join syntax for three tables, below is my code for joining two tables, but the and (after the IN statement) statement is not good because unless there's a link in both tables, table 1 does not show even when available.

mySQL_Statement = "select IDENTIFICATION_DATA.NIIN, IDENTIFICATION_DATA.AIN, USER_REGISTRATION.MC from IDENTIFICATION_DATA, USER_REGISTRATION"

If Not ((TextBox1.Text = String.Empty) And (TextBox2.Text = String.Empty) And (TextBox3.Text = String.Empty) And (TextBox4.Text = String.Empty) And (TextBox5.Text = String.Empty)) Then
mySQL_Statement = mySQL_Statement + " where "
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + "IDENTIFICATION_DATA.NSC IN (" + TextBox1.Text & ") and IDENTIFICATION_DATA.NIIN = USER_REGISTRATION.NIIN"
End If

End if

Thanks,

Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top