[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

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
0
DJ_AM_Juicebox
Asked:
DJ_AM_Juicebox
  • 2
  • 2
1 Solution
 
tigin44Commented:


SELECT student.id, student.name, grade.value
FROM students
      INNER JOIN grades grade ON grade.student_id = student.id
WHERE student.id = 'abc'
       
0
 
igni7eCommented:
SELECT S.ID, NAME, STUDENT_ID, VALUE
FROM STUDENTS S, GRADES G
WHERE S.ID=G.ID AND S.ID='abC'
0
 
tigin44Commented:
didnt you tried my post? It gives the same result as igni7e's post. You should accept my answer or split the points.
0
 
igni7eCommented:
Same result, but my answer is better and cleaner.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now