daveofgv
Well-known member
Hello All -
I have created a windows form application for work in vb.net. Since we have different SQL databases and host names - I created it connection to work with My.Settings files. This works perfect....
The problem is trying to query a select statement to 3 different tables...
Right now my select statement is:
Now, the above code works but I cannot add another WHERE clause that will pull another column that will not effect the above criteria.
For example: If I need all the above criteria but I also want to pull a value from another table (select value from employstats where heightstat = tall)
If I use:
I hope this makes sense
If not, I will try to explain it better...... please let me know.
I have created a windows form application for work in vb.net. Since we have different SQL databases and host names - I created it connection to work with My.Settings files. This works perfect....
The problem is trying to query a select statement to 3 different tables...
Right now my select statement is:
VB.NET:
da = New OleDbDataAdapter("Select EMPLOYEE.AGE, EMPLOYEE.NAME, EMPLOYEE.JOBSTART, EMPLOYEE.SEX, EMPLOYEE.MILITARY, EMPLOYEE.ETHNIC, EMPLOYEE.STATE, EMPLOYEE.JOBID FROM EMPLOYEE INNER JOIN EMPLOYPREV ON EMPLOYEE.JOBID = EMPLOYPREV.JOBID WHERE EMPLOYEE.ISDELETED = 'false' and EMPLOYPREV.NAME like '%" & Textbox1.Text & "%'", con)
Now, the above code works but I cannot add another WHERE clause that will pull another column that will not effect the above criteria.
For example: If I need all the above criteria but I also want to pull a value from another table (select value from employstats where heightstat = tall)
If I use:
VB.NET:
da = New OleDbDataAdapter("Select EMPLOYEE.AGE, EMPLOYEE.NAME, EMPLOYEE.JOBSTART, EMPLOYEE.SEX, EMPLOYEE.MILITARY, EMPLOYEE.ETHNIC, EMPLOYEE.STATE, EMPLOYEE.JOBID FROM EMPLOYEE INNER JOIN EMPLOYPREV ON EMPLOYEE.JOBID = EMPLOYPREV.JOBID WHERE EMPLOYEE.ISDELETED = 'false' and EMPLOYPREV.NAME like '%" & Textbox1.Text & "%'" and INNER JOIN employstats.JOBID ON EMPLOYEE.JOBID WHERE employee.value = employstats.heightstats = 'tall', con)
I hope this makes sense
If not, I will try to explain it better...... please let me know.