sql server - list all students who have not taken midterm for 1 or more subjects -


i have 3 tables likes student,subject,and midterm tables.

student table contains

studid firstname lastname class  1            r        12a 2      b       s        12a 3      c       t        12a 4      d       u        12a 5      e       v        12b 

subject table contains

subid subname   1     maths   2     science   3     english 

midterm table contains

studid subid marks examdate 1        1    100  2014-09-24 1        2     92  2014-09-25 1        2     92  2014-09-26 2        1     74  2014-09-24 2        2     78  2014-09-26 2        3     73  2014-09-26 3        1     90  2014-09-24 3        2     84  2014-09-25 3        2     92  2014-09-25 5        1     87  2014-09-24 4        2     79  2014-09-24 4        3     90  2014-09-26 

the result must be:

firstname lastname subname  

based on below comment , assuming students must take midterms

select firstname , lastname , subname ( select studid , firstname, lastname , subid , subname student , subject) d left outer join midterm m on d.studid = m.studid , d.subid = m.subid m.examdate null 

could write without catesian join should suffice


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -