INSERT INTO confusion

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

    INSERT INTO confusion

    In a gradebook database, every new semester, several classes will have
    identical groups of activities (i.e. "Participation, " "Essays," "Exams,
    etc.) They will also have the same weights as in other semesters. So when
    creating a new class (or course) I have a form with two combo boxes: one
    that selects [courses].[courseCode] to copy from and another that selects
    [courses].[courseCode] for a newer course to copy to. Now I want to copy
    [groups].[groupWeight] and [groups].[groupDescriptio n] from the older course
    and add [groups].[courseCode] from the new course and append all these
    groups into the new course.

    Example:

    courseCode: 12345
    Participation 25
    Essays 50
    Exams 25

    might be appended to same table as

    courseCode: 23456
    Participation 25
    Essays 50
    Exams 25

    where 23456 is the courseCode of the new course and 12345 is the course I'm
    copying from.

    Do I first need to assemble the data into a temporary table then append the
    temp table data back into the groups table? Or can I do it directly with a
    query?


  • MGFoster

    #2
    Re: INSERT INTO confusion

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    INSERT INTO Table1 (courseCode, Participation, Essays, Exams)
    SELECT 23456, Participation, Essays, Exams
    FROM Table1
    WHERE courseCode = 12345

    --
    MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
    Oakland, CA (USA)

    -----BEGIN PGP SIGNATURE-----
    Version: PGP for Personal Privacy 5.0
    Charset: noconv

    iQA/AwUBQQ/Yp4echKqOuFEgEQ JJ1gCfSnCPf+5pz 8K4AgZfM8GD/rE7bYIAoNHb
    JllM30HYmxOcCBO ZNfaZ4goc
    =W2Tv
    -----END PGP SIGNATURE-----


    Richard Hollenbeck wrote:
    [color=blue]
    > In a gradebook database, every new semester, several classes will have
    > identical groups of activities (i.e. "Participation, " "Essays," "Exams,
    > etc.) They will also have the same weights as in other semesters. So when
    > creating a new class (or course) I have a form with two combo boxes: one
    > that selects [courses].[courseCode] to copy from and another that selects
    > [courses].[courseCode] for a newer course to copy to. Now I want to copy
    > [groups].[groupWeight] and [groups].[groupDescriptio n] from the older course
    > and add [groups].[courseCode] from the new course and append all these
    > groups into the new course.
    >
    > Example:
    >
    > courseCode: 12345
    > Participation 25
    > Essays 50
    > Exams 25
    >
    > might be appended to same table as
    >
    > courseCode: 23456
    > Participation 25
    > Essays 50
    > Exams 25
    >
    > where 23456 is the courseCode of the new course and 12345 is the course I'm
    > copying from.
    >
    > Do I first need to assemble the data into a temporary table then append the
    > temp table data back into the groups table? Or can I do it directly with a
    > query?[/color]

    Comment

    • Pieter Linden

      #3
      Re: INSERT INTO confusion

      "Richard Hollenbeck" <richard.hollen beck@verizon.ne t> wrote in message news:<R2MPc.181 02$Je5.8560@nwr ddc03.gnilink.n et>...[color=blue]
      > In a gradebook database, every new semester, several classes will have
      > identical groups of activities (i.e. "Participation, " "Essays," "Exams,
      > etc.) They will also have the same weights as in other semesters. So when
      > creating a new class (or course) I have a form with two combo boxes: one
      > that selects [courses].[courseCode] to copy from and another that selects
      > [courses].[courseCode] for a newer course to copy to. Now I want to copy
      > [groups].[groupWeight] and [groups].[groupDescriptio n] from the older course
      > and add [groups].[courseCode] from the new course and append all these
      > groups into the new course.
      >
      > Example:
      >
      > courseCode: 12345
      > Participation 25
      > Essays 50
      > Exams 25
      >
      > might be appended to same table as
      >
      > courseCode: 23456
      > Participation 25
      > Essays 50
      > Exams 25
      >
      > where 23456 is the courseCode of the new course and 12345 is the course I'm
      > copying from.
      >
      > Do I first need to assemble the data into a temporary table then append the
      > temp table data back into the groups table? Or can I do it directly with a
      > query?[/color]

      I see no reason why you can't do it directly. You could use a form to
      select the old course Code and type in a new one. then you could
      validate both of them and run the insert.

      Comment

      Working...