Home > Software design >  How to findout the grade using two tables in SQL?
How to findout the grade using two tables in SQL?

Time:01-20

Having two tables as below: TABLE 1 TABLE 2

I need to findout the Grades of TABLE 1 from table 2 using Mysql

CodePudding user response:

You can join with the >= and <= operators:

SELECT t1.name, t1.marks, t2.grade
FROM   t1
JOIN   t2 ON t1.marks >= t2.min_mark and t1.marks <= t2.max_mark
  • Related