SQL - SubSelects

Results 1 to 2 of 2

Thread: SQL - SubSelects

  1. #1
    Join Date
    Dec 1969

    Default SQL - SubSelects

    Hi all,<BR>I need to write an SQL to get the the names of students who&#039;s taking English 102, and from these English 102 students, I need to know if they&#039;ve taken English 101 yet. Thanks for any help.<BR><BR>2 tables: TableName and TableClass<BR>TableName: FieldName, FieldClassID<BR>TableClass: FieldClassID, FieldClassDesc <BR><BR>The output should be something like this:<BR>Name Class102 Class101<BR>----------------------<BR>Ammy 102 <BR>Ben 102<BR>David 102 101<BR>Mary 102 101<BR>Robert 102<BR>Steve 102

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL - SubSelects

    Select TN.Name, TC1.classdesc, tc2.classdesc from tableName TN LEFT JOIN tblClass TC1 on TC1.FieldClassID = TN.fieldClassID LEft JOIn TABLECLASS TC2 ON TC2.FieldClassID = tn.fieldclassID<BR>group By TN.Name, TC1.fieldClassID, tc2.FieldCalssID<BR><BR>HTH<BR>D.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts