Results 1 to 2 of 2

Thread: joining tables

  1. #1
    Join Date
    Jan 2003

    Unanswered: joining tables

    I'm very new at my sql and I have the following problem:

    I'm building a grammar website and I have amongst other things one table that stores details about each grammar module (name, number of exercises, description), one table called exercises that defines each exercises (code, which grammar module they belong to, level...) and one table that stores the marks (exercise code, mark, date...).

    I want to query the database so that only the marks for a particular grammar module appears.
    I've tried the following in mysql:

    select exercisecode,marks from marks where exercisecode=(select code from exercises where grammarmodule='de');

    but I have error messages. Could anyone help me?


  2. #2
    Join Date
    Jan 2003
    Paris, France
    Sub query are not allowed in mysql. You should transform all your sub querie in join statement

    select exercisecode,marks from marks
    inner join exercises
    on exercisecode = code and grammarmodule='de'
    Olivier Miossec

Posting Permissions

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