Connecting Tech Pros Worldwide Help | Site Map

INSERT INTO confusion

Richard Hollenbeck
Guest
 
Posts: n/a
#1: Nov 13 '05
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].[groupDescription] 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
Guest
 
Posts: n/a
#2: Nov 13 '05

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:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBQQ/Yp4echKqOuFEgEQJJ1gCfSnCPf+5pz8K4AgZfM8GD/rE7bYIAoNHb
JllM30HYmxOcCBOZNfaZ4goc
=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].[groupDescription] 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]

Pieter Linden
Guest
 
Posts: n/a
#3: Nov 13 '05

re: INSERT INTO confusion


"Richard Hollenbeck" <richard.hollenbeck@verizon.net> wrote in message news:<R2MPc.18102$Je5.8560@nwrddc03.gnilink.net>.. .[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].[groupDescription] 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.
Closed Thread