Mysql query problem

后端 未结 8 831
逝去的感伤
逝去的感伤 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 04:08

    If I understand correctly:

    SELECT grades.*,sections.* 
      FROM grades INNER JOIN sections ON sections.id = grades.section_id 
      WHERE user_id=$id  ORDER BY grades.date DESC LIMIT 1
    

提交回复
热议问题