JOIN 3 tables

Hi guys I need to join my 3 tables

I need to display the data from classlist, account, and student table from a specific class identified by the claID.

For Example:
If I want to display all students coming from class 77, their data from the three table will be joined even if the classlist doesnt match any record on the account and student table.

I need your help ASAP. Thanks in advanced :blush:
classList


cllID claID accID
77ses-jap 77 [->] ses-jap [->]
77ses-1-2 77 [->] ses-1-2 [->]
79ses-jap 79 [->] ses-jap [->]

account


accID accFName accLName accMidName accEAdd
ses-admin Jdfafypfe Tdf Gfads
ses-stu Jap Jap Jap djflaj

student


stuID accID stuCourse stuYearLevel stuSection
12345 ses-12345 [->] BSIT 1 dfadsfd
stu ses-stu [->] BSIT 1 a
1 ses-1 [->] BSIT 1 A

wha???

could you do a SHOW CREATE TABLE for these three tables please

oops my bad, my apologies

Table
classlist

CREATE TABLE classlist (
cllID varchar(20) NOT NULL,
claID varchar(15) NOT NULL,
accID varchar(20) NOT NULL,
PRIMARY KEY (cllID)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

Table
account

CREATE TABLE account (
accID varchar(15) NOT NULL,
accFName varchar(30) NOT NULL,
accLName varchar(30) NOT NULL,
accMidName varchar(30) NOT NULL,
accEAdd varchar(30) NOT NULL DEFAULT ‘notspecified@ses.com’,
accPic varchar(50) NOT NULL,
accType varchar(10) NOT NULL,
accPassword varchar(32) NOT NULL,
accStatus varchar(8) NOT NULL,
PRIMARY KEY (accID),
KEY accID (accID)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

Table
student

CREATE TABLE student (
stuID varchar(15) NOT NULL,
accID varchar(15) NOT NULL,
stuCourse varchar(60) NOT NULL,
stuYearLevel varchar(15) NOT NULL,
stuSection varchar(10) NOT NULL,
PRIMARY KEY (stuID)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

SELECT s.stuID
     , s.stuCourse
     , s.stuYearLevel
     , s.stuSection
  FROM classlist AS c
INNER
  JOIN student AS s
    ON s.accID = c.accID
 WHERE c.claID = '77'

:slight_smile:

Thanks thanks :smiley: