多个INNER JOIN SQL访问语法

时间:2021-06-03 11:29:43

I am trying to fetch data from table(six_attendance, five_attendance) via INNER JOIN with table(users). Here is what I have tried:

我试图通过INNER JOIN从表(用户)获取表(six_attendance,five_attendance)中的数据。这是我尝试过的:

$query = mysql_query("SELECT * 
FROM
(users 
INNER JOIN six_attendance 
ON users.username = six_attendance.username)
INNER JOIN five_attendance 
ON users.username = five_attendance.username
WHERE six_attendance.username OR five_attendance.username ='$reg_no'");

1 个解决方案

#1


0  

$query = mysql_query("SELECT * 
FROM
users 
INNER JOIN six_attendance 
ON users.username = six_attendance.username
INNER JOIN five_attendance 
ON users.username = five_attendance.username
WHERE six_attendance.username='$reg_no' OR five_attendance.username ='$reg_no'");

#1


0  

$query = mysql_query("SELECT * 
FROM
users 
INNER JOIN six_attendance 
ON users.username = six_attendance.username
INNER JOIN five_attendance 
ON users.username = five_attendance.username
WHERE six_attendance.username='$reg_no' OR five_attendance.username ='$reg_no'");