Link to home
Start Free TrialLog in
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

asked on

Inner join with a where clause?

Hi,

I need to do a join with a where clause. Something like:

  // students
  id | name

  // grades
  id | student_id | value

SELECT student.id, student.name, grade.value FROM students WHERE student.id = 'abc' AS student INNER JOIN grades grade ON grade.student_id = student.id
       
Basically I want to select some fields from the students table, some fields from the grades table, where the student id = "abc",

Thanks
Avatar of tigin44
tigin44
Flag of Türkiye image



SELECT student.id, student.name, grade.value
FROM students
      INNER JOIN grades grade ON grade.student_id = student.id
WHERE student.id = 'abc'
       
ASKER CERTIFIED SOLUTION
Avatar of igni7e
igni7e
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
didnt you tried my post? It gives the same result as igni7e's post. You should accept my answer or split the points.
Same result, but my answer is better and cleaner.