Results 1 to 2 of 2

Thread: SQL Statement - INNER JOIN 3 TABLES

  1. #1
    Join Date
    Dec 1969

    Default SQL Statement - INNER JOIN 3 TABLES

    I have one database with 3 tables which i need to INNER JOIN those three tables with a SQL statement, what is the syntax for to INNER JOIN 3 tables. <BR><BR>Tables:<BR>employeedb<BR>logindb<BR>deptdb <BR><BR>Now employeedb and logindb can be join by the empid field, and then i need to innerjoin employeedb and deptdb by the dept field<BR><BR>Thanks for the help in advance,<BR>SKOOTER

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Statement - INNER JOIN 3 TABLES

    Actually, you don&#039t *need* the JOIN keyword to do an inner join.<BR><BR>You can do it more simply this way:<BR><BR>SELECT E.*, L.*, D.*<BR>FROM Employees AS E, Logins AS L, Departments AS D<BR>WHERE D.departmentID = E.departmentID<BR>AND E.employeeID = L.employeeID<BR>AND L.username = &#039Jones&#039<BR>AND L.password = &#039SIZZLEGREP&#039<BR><BR>(I presume that&#039s what you were looking for: The user gives name and password and you get *all* the relevant info?)<BR><BR>Oh...incidentally, if you use that syntax, the SQL engine converts it to an INNER JOIN automatically.<BR><BR><BR><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