Mysql query problem

后端 未结 8 926
逝去的感伤
逝去的感伤 2020-12-22 03:24

I have a problem with my mysql query.

My database:

sections
id
section_name

grades
id
user_id
section_id
date
grade

I want my data

8条回答
  •  时光取名叫无心
    2020-12-22 03:54

    SELECT sections.section_name, grades.grade
    
                        FROM 
                        grades, 
                        sections 
    
                        WHERE 
                        sections.id = grades.section_id
    
                        AND
                        grades.user_id = '.$id.'
    
                        ORDER BY grades.date DESC
    
                        LIMIT 1
    

    try this?

提交回复
热议问题