简体   繁体   中英

Retrieve the data from three different tables based two parameters in php mysql

This is what i tried :

SELECT  A.cs_id, 
        A.class, 
        B.sec_id, 
        B.cs_id, 
        B.cs_name,
        C.stud_id,
        C.stud_class, 
        C.stud_section,
        C.stud_adm_no, 
        C.stud_full_name 
FROM class_section AS A  
INNER JOIN section_name as B ON A.cs_id=b.cs_id 
INNER JOIN student_detail as c ON C.stud_class=B.sec_id WHERE A.cs_id=1

It's retrieving the higher order variable only

SELECT  
A.cs_id, 
A.class, 
B.sec_id,
B.cs_name,
C.stud_id,
C.stud_class, 
C.stud_section,
C.stud_adm_no, 
C.stud_full_name 
FROM class_section AS A  
INNER JOIN section_name as B ON A.cs_id=B.cs_id 
INNER JOIN student_detail as C ON C.stud_class=B.sec_id WHERE A.cs_id=1

May be your alias problem b should be B c should be C

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM