Home > Blockchain >  Fetching Data from 3 different tables based on Where Parameters - MySQL
Fetching Data from 3 different tables based on Where Parameters - MySQL

Time:11-02

I need to Select the delegate’s no. & name along with the module’s code & name for delegates who have taken a module but have a grade below 40 ( in the 'take' table )

Here's a link to what i'm doing - http://sqlfiddle.com/#!9/3e2c26

please ignore how bad the original query is for now i'm just trying to get my head around it

CodePudding user response:

Join the table and pick the columns

SELECT d.no, d.name,m.code,m.name  FROM take t INNER JOIN delegate d ON d.no = t.no
INNER JOIN module m ON m.code = t.code WHERE grade < 40
  no | name | code | name   
---: | :--- | :--- | :------
2002 | Andy | A2   | ASP.NET
2002 | Andy | A3   | PHP    

db<>fiddle here

  • Related