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
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