老師表的結果如何獲得MySQL查詢與條件
teacher_id teacher_name
============================
1 john
2 doe
學生表
student_id student_name student_score teacher_id
==========================================================
1 amelia 0 1
2 anderson 0 1
3 fabiano 0 1
4 ronaldo 0 2
5 peter 6 2
6 alex 0 2
結果
teacher_id teacher_name
============================
2 doe
結果是老師記錄誰一個或更多的是他的學生得分> 0。
如何查詢這個?
感謝您的回答和對不起我的英文不好
SQL Basic應該可以幫到你。 – Milaci
[Left join with condition]的可能重複(http://stackoverflow.com/questions/9160991/left-join-with-condition) – PereG
選擇t。 teacher_id,T。 teacher_name from teacher t,student's where t.teacher_id = s.teacher_id and s.score> 0. – Milaci