SQL Query.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • easyhost

    #1

    SQL Query.

    Hi All,
    I'am new to SQL. I am just working on a simple school project for my
    finals. I've a problem and i am defining it here.

    There are 3 tables.

    1) Exammaster.
    - Examid
    - Examname

    Eg of a record : 1, Quarterly.


    2) StudentMaster.
    - StudentID
    - Studentname
    - Class

    Eg of a reacord : 1, John, 3rd Standard.

    3) ScoresMaster.
    - ScoresMasterID
    - ExamID
    - StudentID [From Student Master].
    - SubjectID.
    - Score.

    Eg. of a record : 1, 1, 1, 1, 89.


    while entering scores into scores master, I have a page that gives me
    the names of all the students [a drop-down list box] and below that a
    form to enter their scores.

    My query is that I want only names of those students whose scores have
    not been entered yet into the scoresmaster.

    Which logically is ... names all those students whose scores have not
    been entered into the scoresmaster yet and who belong to class 9.

    Can somebody help me plz .... ????


    Regards,
    247EasyHost.

  • Jeff L

    #2
    Re: SQL Query.

    Select FieldNames[color=blue]
    >From StudentMaster Left Outer Join ScoresMaster ON[/color]
    StudentMaster.S tudentID = ScoresMaster.St udentID
    Where ScoresMaster.St udentID Is Null
    And Class = 9

    If the ScoresMaster.St udentID is null, that means the student from
    class 9 has not been entered into the table yet.

    Hope that helps!

    Comment

    Working...