searching more than one table

Results 1 to 2 of 2

Thread: searching more than one table

  1. #1
    Join Date
    Dec 1969

    Default searching more than one table

    i have the following sql statement, however i need to access another table in the database called location which is linked by a relationship with my table tblemployees<BR><BR>Select * From Tblemployees, Where Surname Like &#039;%" & Request.form("surname") & "%&#039; And position Like &#039;%" & Request.form("position") & "%&#039; And department Like &#039;%" & Request.form("department") & "%&#039; And location Like &#039;%" & Request.form("location") & "%&#039;;" <BR><BR>Can any one help me with the syntax, i thought that SELECT * From tblemployees,tblemployees.location would work, but no it didnt.<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: searching more than one table

    You should specify the relationship between these two tables, or you&#039;ll get too much results...<BR><BR>SELECT * FROM tblEmployees, tblLocation WHERE .... AND tblEmployees.LocationID = tblLocation.LocationID<BR><BR>or something like this, depending on the relation and the name of the columns of your tables...<BR><BR><BR>Also another hint: don&#039;t punt the values from your Request directly into your query.<BR>Think about what would happen if somebody typed in this<BR> "hello&#039;;DELETE * FROM tblEmployees;"<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts